Retrieve Multiple Rows
hi i want to retrieve the multiple rows i am using asp.net and SQL back end the code below
Dim dtr As SqlDataReader dtr = cmdDetails.ExecuteReader
While dtr.Read ID = CInt(dtr.GetValue(2))
the above retrieves only the last row
can u please help me
babu
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
Can't Retrieve All Rows From Database Table
For some reason, I can't get all my table rows returned when I write my SQL Query. For example:
Select * from TABLE_NAME returns 2200 rows when there are 2500
Select ID from TABLE_NAME returns all 2500
Any idea why? Is there a size limitation to my variant variable? My code is as follows:
Dim SQLString, ConnectionString As String
Dim Results As Variant
ConnectionString = "ODBC;Driver={SQL Server};Server=SERVER;Database=DATABASE;UID=hello;PWD=world;"
SQLString = "SELECT * FROM TABLE_NAME"
Results = Run("getSQLServerRows", SQLString, ConnectionString, , , 1) <-- simple macro that executes sql code
Worksheets("Sheets").Range("A1:U" & (UBound(Results) + 1)) = Results
......
When I open up my locals window and look at what has been returned, not all the rows are there. This happens intermittantly depending on the table. Might work fine for one table (13000 rows, 20 columns), but doesn't work for others (2500 rows, 49 columns).
Any help or suggestions to fix would be appreciated.
Thanks.
Urgent--Not Albe To Retrieve All The Rows From Datagrid
I have a grid which can display 3 records..if i have a recordset containing 6 records...then i need to traverse through scroll bar..
if i programmatically try to traverse through all the records in the grid..using "ApproxCount" method..which gives me the recordcount of the datagrid and using "Row" method for accessing individual row values..
In this case my program is displaying only the records that are visible. I am not able to access Invisible records. Data grid has a method called "FirstRow" which allows recrods to be displayed only from visible..
Can anyone suggest me how to retrieve all the rows in the datagrid. EVEN THE ROWS THAT ARE INVISIBLE...
Thanking you.
Regards
Sekhar
Time To Retrieve 10000 Rows And Display Them? What Is Acceptable?
OK, regardless of what technology you have used, or what type of design your app follows, how long would you expect it to take to retrieve 10,000 records and display them in some form of control?
Now I don't care about the number of fields etc. Just a rough time.
Everyone who has written a DB app must have tested it and thought "That's slow, oh if I do this then it speeds it up.".
If 10,000 records took me 185 seconds to retrieve and display then there is something wrong and my application need optomising.
So, roughly what is an acceptable time?
Woka
Retrieve Multiple Registry Keys
This code Imports one key to a file.
How can I change it so that it can import multiple keys to one file?
thanks.
Code:
Private Sub ExportRegNode(ByVal strKeyPath As String, _
ByVal strFile As String)
On Error GoTo Hell
'strKeyPath is the key to export
' sample: HKEY_CURRENT_USERSoftwareMicrosoft
'strFile is the file to export to with and extension of .reg
' sample: c:exportedkey.reg
'Perform the export
Shell "regedit /e " & strFile & " " & strKeyPath, vbHide
Exit_For:
On Error GoTo 0
Exit Sub
Hell:
GoTo Exit_For
End Sub
Private Sub ImportRegNode(ByVal strFile As String)
On Error GoTo Hell
'strFile is the file to export to with and extension of .reg
' sample: c:exportedkey.reg
'SilentImport imports the reg keys with no msgboxes or user
' intervention
'Build Switchs
Dim strSwitches As String
strSwitches = "/i "
strSwitches = strSwitches & "/s "
'Perform the import
Shell "regedit " & strSwitches & strFile, vbHide
MsgBox ("Wireless Config Restored")
Exit_For:
On Error GoTo 0
Exit Sub
Hell:
GoTo Exit_For
End Sub
How To Retrieve Data From Multiple Tables?
Hello all!
I need to retrieve the name of the jobs existing in sql server agent and at the same time, their respective schedule.
Using the statement "SELECT name AS JobName FROM sysjobs" will retrieve the names of the jobs and using the statement "SELECT freq_type AS JobSchedule FROM sysjobschedules" will retrieve the schedule type of the respective jobs.
But I need to display the job name and the job schedule type together, executing the appropriate sql statement in SQL Query Analyzer. How do I go about using the SELECT statement for 2 different tables?
The "appropriate" SQL, when executed, should produce:
--------------------------------
JobName /JobSchedule/
--------------------------------
Job1 /4 /
Job2 / 64 /
Thanks in advance
Edited by - MMC_Newbie on 10/16/2002 11:07:04 PM
Add Multiple Rows In Access
Hi hope you can help. i have written a db in access but i am a bit stuck in one area.
We supply telephone numbers, and when we get allocated a batch of numbers i want to be able to add that range of numbers in one go., e,g
I have 0870 XXX 100 upto 0870 XXX 199how can i add that range to a table in one move rather than hving to sit there and type out each one.
Many thanks
T
Selecting Multiple Rows
I have a spread sheet with the following data
1010801203901018018/1/2001
1010801204501018018/1/2001
1010801204801018018/1/2001
1010801205101018018/1/2001
1010801205401018018/1/2001
1010801205701018018/1/2001
10108012103107.51018018/1/2001
10108081042107.51018088/8/2001
10108081045107.51018088/8/2001
10108081048107.51018088/8/2001
10108081054107.51018088/8/2001
10108081057107.51018088/8/2001
10108081103107.51018088/8/2001
10108081106107.51018088/8/2001
10108081109107.51018088/8/2001
10108081115107.51018088/8/2001
10108081118107.51018088/8/2001
10108081121107.51018088/8/2001
10108081124207.51018088/8/2001
10108122054207.51018128/12/2001
10108122057207.51018128/12/2001
10108122100207.51018128/12/2001
10108122103207.51018128/12/2001
10108122112207.51018128/12/2001
10108122115207.51018128/12/2001
10108122118207.51018128/12/2001
10108122121207.51018128/12/2001
10108122124207.51018128/12/2001
10108122130207.51018128/12/2001
10108122139207.51018128/12/2001
10108122142207.51018128/12/2001
10108122148207.51018128/12/2001
10108122151207.51018128/12/2001
10108122203207.51018128/12/2001
10108122212207.51018128/12/2001
10108122218207.51018128/12/2001
10108122221207.51018128/12/2001
10108122230207.51018128/12/2001
10108122233207.51018128/12/2001
10108122236207.51018128/12/2001
10108122239207.51018128/12/2001
10108122242207.51018128/12/2001
10108122245207.51018128/12/2001
1010812225482.51018128/12/2001
101081394582.51018138/13/2001
101081394882.51018138/13/2001
101081395182.51018138/13/2001
101081395482.51018138/13/2001
101081395782.51018138/13/2001
1010813100082.51018138/13/2001
1010813100382.51018138/13/2001
1010813100682.51018138/13/2001
1010813100982.51018138/13/2001
1010813101282.51018138/13/2001
1010813101582.51018138/13/2001
101081310181951018138/13/2001
101081314181951018138/13/2001
101081314241951018138/13/2001
101081314271951018138/13/2001
101081314301951018138/13/2001
101081314421951018138/13/2001
101081314451951018138/13/2001
101081314481951018138/13/2001
101081314541951018138/13/2001
101081314571951018138/13/2001
101081315001951018138/13/2001
101081315031951018138/13/2001
101081315091951018138/13/2001
101081315121951018138/13/2001
101081315151951018138/13/2001
101081315241951018138/13/2001
101081315301951018138/13/2001
101081315331951018138/13/2001
101081315361951018138/13/2001
101081315391951018138/13/2001
101081315421951018138/13/2001
101081315451951018138/13/2001
101081315481951018138/13/2001
101081315511951018138/13/2001
101081315541951018138/13/2001
101081315571951018138/13/2001
101081316001951018138/13/2001
101081316091951018138/13/2001
101081316121951018138/13/2001
101081316151951018138/13/2001
101081316211951018138/13/2001
101081316271951018138/13/2001
101081316301951018138/13/2001
101081316331951018138/13/2001
101081316391951018138/13/2001
101081316421951018138/13/2001
101081316481951018138/13/2001
101081316511951018138/13/2001
101081316571951018138/13/2001
101081317001951018138/13/2001
101081318481951018138/13/2001
101081318541951018138/13/2001
101081319091951018138/13/2001
101081319391951018138/13/2001
101081319421951018138/13/2001
101081319481951018138/13/2001
101081319511951018138/13/2001
101081319571951018138/13/2001
101081320031951018138/13/2001
101081320181951018138/13/2001
101081320211951018138/13/2001
Since there is a lot of duplicate data in the 3rd column (column C), I want to filter the data to delete every row where column c =column c's previous value. I'm clueless where to start.
Selecting Multiple Rows
I'm using the MSHflexGrid control and I need to be able to select several non-sequential rows. ArnoutV helped me a lot and provided the code (Thanks ArnoutV). The problem is that although we both use the same code, it seems to work for him -- but not for me.
I am getting no errors and I -am- able to select rows, but never more than one at a time. The background color does change, but when I select another row I loose the first (it changes back to its original color). And yes, I am using CTRL+Click too.
I've attached the test program.
Thanks
How Do I Insert Multiple Rows?
Hi,
I am trying to insert multiple rows into my database, but I am not sure how to do it, I have been inserting each line, by writing an insert statement for each - is there a quicker way? I also have the records in a text file, so Is there a way of writing this statement so that it imports all rows from the file, regardless of how many rows there are? I am using SQL Anywhere v5. and am fairly new to SQL. My current code is:
Code:
INSERT INTO work_type (team_code, date_of_event, start_time, event_name) VALUES ('AT1-01', '2004/01/12', '20:35');
INSERT INTO work_type (team_code, date_of_event, start_time, event_name, ) VALUES ('AT1-01', '2004/04/01', '01:45',);
INSERT INTO work_type (team_code, date_of_event, start_time, event_name, ) VALUES ('AT1-01', '2004/01/11', '17:04');
INSERT INTO work_type (team_code, date_of_event, start_time, event_name, ) VALUES ('AT1-01', '2004/01/23', '00:00');
Thanks in advance
How To Add Multiple Rows In A ListView
This is the code I am using to add information to the ListView, how do I get the text to be placed on multiple rows? Right now the code populates the ListView on one single row until it is forced onto another row. Thanks in advance for any help.
Dim j%, k%
Dim l As ListItem
'Add the ListView ColumnHeaders
For j = 1 To 2
ListView1.ColumnHeaders.Add , , _
"Column " & CStr(j), 1000
Next
For j = 1 To 2
'Add a ListItem
Set l = _
ListView1.ListItems.Add(, , "Item " & CStr(j))
Next
Multiple Rows...Addition
Hi All,
Is it possible to add multiple rows at one click of command button into table ..
If yes could you please give me code example in brief...
Regards
Santosh
Combining Multiple Rows Into One Row
Hi,
I have a view which selects these columns: employeenumber,ClientID,Billing code,amountBilled,InvoiceNumber from a number of other tables.
One Employee may have many billingAmounts.
My view right now has each row for every Amount Billed for each Employee.I want to have a query which has only one row for each employee with repeating cloumns if they have multiple billings.
If an employee A has one row in the view,i want my output in this format.
EmployeeNumber,ClientID,BillingCode1,AmountBilled1 ,InvoiceNumber1
If an employee A has two rows in the View,i want my output in this format.
EmployeeNumber,ClientID,BillingCode1,AmountBilled1 ,InvoiceNumber1,BillingCode2,AmountBilled2,Invoice Number2
If an employee A has three rows in the View,i want my output in this format.
EmployeeNumber,ClientID,BillingCode1,AmountBilled1 ,InvoiceNumber1,BillingCode2,AmountBilled2,Invoice Number2,BillingCode3,AmountBilled3,InvoiceNumber3
etc..
I do not know in advance the maximum number of Invoices a employee may have.There is no fixed limit on this.however,i have noticed in my database that we do not have more than 5 till date.
How can I write a query to accomplish this?Please help.
--------------------------------------------------------------------------------
Splitting A Row Into Multiple Rows
Hey Gang, I was wondering if there is a way to split up the results from a query?
The table is setup simular to this.
Project, Manager, Estimator, Asst_Manager
I would like to somehow get a result set broken down like this:
'Windows', 'Manager', 'Tim'
'Windows', 'Estimator', 'Fred'
'Windows', 'Asst_Manager', 'Sally'
''Suse'', 'Manager', 'Bob'
''Suse'', 'Estimator', 'John'
''Suse'', 'Asst_Manager', 'Igor'
.....
The examples I have found either deal with joning 2 fields, ie cast(Manager as varchar) + ' ' + Cast(Estimator as varchar) ...
or involve creating temporary tables to do this (which I would like to avoid if possible)
The reason I was looking to do this was to be able to sort the results by name, regardless of what position they hold.
''Suse'', 'Manager', 'Bob'
'Windows', 'Estimator', 'Fred'
''Suse'', 'Asst_Manager', 'Igor'
''Suse'', 'Estimator', 'John'
'Windows', 'Asst_Manager', 'Sally'
'Windows', 'Manager', 'Tim'
If there is a way to sort the results without putting them into 1 column, that will work just as well.
Anyone have any experience with this? Otherwise I will just go the temp table route.
Thanks!
Validations For Multiple Rows In Excel VBA
Hi
I have An Excel Sheet that has validations like numerical check , email validation for the first row. Now I want to extend that validations to 100 rows using VBA. I tried but ididnt get any idea. Here u can see the code for validations for first row ....... Thanks in Advance.
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.address = "$E$11" Then
If intCheck(Sheets.Item("Calls only (CPS or IDA)").Range("E" & 11), Sheets.Item("Calls only (CPS or IDA)").Range("E" & 11).Value) = False Then
Sheets.Item("Calls only (CPS or IDA)").Range("E" & 11).Select
MsgBox "Only Numericals Allowed for C&W A/C No", vbCritical, "Number Validation"
End If
End IF
End Sub
PLease help me..........
Selecting Multiple Rows In MSHFlexGrid
I have a MSHFlexGrid called MSHDataGrid1. I read data to the MSHDataGrid1 from a SQL server 2000 table. What I want to do is when the operator selects multiple rows I want to read the data. I know how to do a single row, but how do I read multiple rows from the MSHFlexGrid? Here is code to read a single row
Me.txtShortNumber.Text = Me.MSHFlexGrid1.TextMatrix(MSHFlexGrid1.Row, 2)
Me.txtQuantity.Text = Me.MSHFlexGrid1.TextMatrix(MSHFlexGrid1.Row, 4)
Me.txtDestination.Text = Me.MSHFlexGrid1.TextMatrix(MSHFlexGrid1.Row, 5)
Hinding Rows In Multiple Worksheets
In order to hide a selection of rows in multiple (3) worksheets I used the following macro. It does not seem to function properly, and I can not figure out why. The only sheet in which the rows are properly hidden is the "MT" sheet, the hinding does not function in the two remaining sheets.
The rows which are selected for hiding, contain the word "obsolete". I know it ancient but it is for excel97.
Hopefully somebody has a suggestion.
Thanx!
Kraven
Sub Obsolete()
'
' Obsolete Macro
' Hiding obsolete studies in all sheets
'
Application.ScreenUpdating = False
Sheets("General Information").Select
Range("A3").Select
Selection.Sort Key1:=Range("A3"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
Sheets("General Information").Select
Dim r As Range: Set r = Range("z2:z200")
r.EntireColumn.Insert
r.Offset(0, -1).FormulaR1C1 = "=RC[1]=""Obsolete"""
r.Rows().Hidden = r.Offset(0, -1).Value
r.Offset(0, -1).Delete
Sheets("Study Information").Select
Range("A3").Select
Selection.Sort Key1:=Range("A3"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
Sheets("Study Information").Select
Dim s As Range: Set s = Range("z2:z200")
s.EntireColumn.Insert
s.Offset(0, -1).FormulaR1C1 = "=RC[1]=""Obsolete"""
s.Rows().Hidden = s.Offset(0, -1).Value
s.Offset(0, -1).Delete
Sheets("MT").Select
Range("A3").Select
Selection.Sort Key1:=Range("A3"), Order1:=xlAscending, Header:=xlGuess, _
OrderCustom:=1, MatchCase:=False, Orientation:=xlTopToBottom
Sheets("MT").Select
Dim t As Range: Set t = Range("z2:z200")
t.EntireColumn.Insert
t.Offset(0, -1).FormulaR1C1 = "=RC[1]=""Obsolete"""
t.Rows().Hidden = t.Offset(0, -1).Value
t.Offset(0, -1).Delete
Application.ScreenUpdating = True
End Sub
Average Multiple Excel Rows Together By Name?
Hello,
I'm not sure how to ask this question, so I'll just explain the situation.
I have a list of data, it is broken out by person, and by day.
If I get this list for a week, it looks something like this - Spaces would indicate a new cell.
(Person) (Monday) (November) (20) (2003) (metric)
(Person) (Tuesday) (November) (21) (2003) (metric)
(Person) (Wednesday) (November) (22) (2003) (metric)
.
.
(Person2) (Monday) (November) (20) (2003) (metric)
What I'm wanting to do, is on another sheet, obtain the average of all metrics for a perticular person.
With an end result on the other sheet of something like
(Person) (week's metric average)
(Person2) (week's metric average)
I was thinking of using vlookup, but since I have multiple lines per person I'm not sure if that would work properly.
The other thing - not everyone will have a full weeks worth of data, some might have anywhere btween 1 and 7.
Thanks for any help!
Updating Multiple Rows In Access
Hi,
I'm trying to update different rows with different values. can anyone tell how to update multiple rows in access usin VB6.
Eg. updating a students table in which in different marks of different subjects are to be updated in student's rows.
Thank You
Shalabh
FlexGrid Help - Update Multiple Rows
The script below puts some text in column 4 of my flexgrid when one date is less than the other, it also changes the colour of the cell. This script works fine but I have 100+ rows. I could write this script for each row of my flexgrid but that will take me hrs/days. Can someone please help me write a script to automate this for all rows.
Cheers, Scotty
Private Sub Form_Load()
Dim dDate1 As Date
Dim d2Date1 As Date
dDate1 = CDate(Format(MSFlexGrid.TextMatrix(1, 3), "dd/mm/yyyy"))
d2Date1 = CDate(Format(PDate.Text1.Text, "dd/mm/yyyy"))
If dDate1 < d2Date1 Then
MSFlexGrid.TextMatrix(1, 4) = "Investigate Problem"
Call ColorRow(1, vbWhite, vbRed)
Else
MSFlexGrid.TextMatrix(1, 4) = "OK"
End If
Adding Multiple Rows From A File
Hi all, long time reader, first time writer.
To start, I'm using Office XP and the VB that comes with that.
Basicly, I've got a text file that contains the values for the rows in a table. There are over 700 entries for this table, so I really don't want to enter them individually. I have no problems reading the data and such, but whenever you add a row you get a warning message from Access every time a row is entered. Is there some way to eliminate this warning, or lump all the row entries into one warning message?
Basically, my code is like this:
Do While count < numLines
lineIn = a.ReadLine()
ar = Tokenize(lineIn, Seps)
Dim SQL As String
SQL = "SQL Statement"
DoCmd.RunSQL SQL
count = count + 1
LoopAny help or suggestions would be appreciated. Thanks
Insert Multiple Rows In Table
This is an inventory program...
I have several products in inventory already...
I'm adding a new customer and selecting 2 products for this customer to have...
I now have to add the new customer to the customers table and 2 records to the transactions table for the 2 products they got right? This is how i'm adding my new customer to it's table.
Code:
Set rs = db.OpenRecordset("JoinAll")
rs.AddNew
rs!cName = txtcName.Text
rs!cAddress = txtcAddress.Text
rs!cCity = txtcCity.Text
rs!cState = txtState.Text
rs!cZip = txtcZip.Text
rs!cPhone = txtcPhone.Text
rs!cPlan = cmbPlan.Text
rs!Date = txtcDate.Text
rs.Update
JoinAll is a Query in my access 2000 database to connect all three tables
If this customer selected 2 products to purchase, how do i go about adding 2 records to the transactions table at one time? A Loop?? A new recordset??
Here are my table structures:
Customers Table
cID, cName, cAddress, cCity, cState, cZip, cPhone, cPlan, Date
Products Table
pID, pName, pModel, pSerial, pDescription, pCategory
Transactions Table
tID, tcID, tpID
Am i going about this the right way?
Thanks
Inserting Multiple Rows Into An Oracle DB
Hi
Here is my problem:
I want to insert multiple rows from an excel sheet into a oracle table.
I've built a loop that collects all the data into a string
BUT - how can I code a line shift so that the sql is valid?
Now the string looks like this:
strInsertSql= "Insert into oratable values(1, 2, 3)Insert into oratable values(2,3,4)insert into oratable values(4,5,6).................
What I want is something like this I guess(or something similar):
strInsertSql= "Insert into oratable values(1, 2, 3)
Insert into oratable values(2,3,4)
Insert into oratable values(4,5,6)"
Any sollutions to this or do I have to insert one row at a time?
Thks
Kjell-Ivar
Saving Multiple Rows In A SQL Database
I am currently faced with a complicated situation and I am not certain I can explain it clearly so I apologize in advance if this doesn't make a lot of sense.
I am receiving a comma delimited text file from an outside vendor. The layout looks like this
MSH,12345,08/29/2003,82312345,ERT,2,3,PID,Schmo,Joe,M,W,N,04/22/1957,ABC123456789,JS12345,EL,Illif,12345,123,B,Anywhere Lane,West,1234 B Anywhere Lane,Nowhere,KS,11111,SAM,08/21/2003,,N,04,Family Practioner,08/27/2003,09/02/2003,SPM,17,Other,HIV,22,ABC,N,01,01,SPM,02,,RUB,02,04/02/2003,TLC,Test coment Rubella,PID,Doe,Jane,F,W,N,03/25/1967,DEF987654321,12345ABC,SN,DRNO,2345,987,SW,Smith Drive,NULL,987 SW Smith Drive,Nowhere,KS,11111,SAM,08/21/2003,,N,11,Other,,,SPM,01,,HIV,A1,DEF,N,01,01,RLC,Did this test work
I have managed to separate each field into a variable and now need to save those variables onto a SQL table.
The problem is I have multiple PID’s and multiple SPM’s. I need to insert a new line for each. For example since I have 2 SPM’s for PID Joe Schmo I will need
Two lines in the SQL table. The first line must contain the MSH information, the PID information, the SAM information and the first SPM information, and the HIV information.
The second line must contain the MSH information the PID information, the SAM information and the second SPM information, the RUB information, the TLC information.
I have attempted to insert this information all at once but only get the information for the PID, SAM,SPM,HIV, and RLC information for Jane Doe.
When I use a loop I get an error message telling me MSH cannot be NULL and the transaction is aborted.
DataGrid Multěple Rows Selection
Hello people, I would like to be able to select multiple rows in a datagrid as i click and drag the mouse over my datagrid just like excel. So far I can only select one at a time. Please advice and thank you in advance for your help
Selecting Rows From Multiple Columns
When selecting rows from multiple columns for instance:
Select table1.thisNumber, table2.voidable
FROM table1, table2
WHERE (table1.thisNumber = table2.thisNumber)
If there is no record in table2 for thisNumber is it possible to still retrieve that record and set the voidable field to false?
Delete Multiple Rows In Hflexgrid
Hi all. I was wondering if someone can help me out with this....seems simple. I need to delete selected row(s) from a hflexgrid. I know how I can delete one row the user selects, but how do I delete a group of rows? Do I have to loop through each one and take them out?
Delete Multiple Rows In A Msflexgrid ?
Hello. My application is connected to the database and the records are reflected on a flexgrid. I use this code to select multiple rows in a flexgrid:
Code:
Private Sub MSHFlexGrid1_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
With MSHFlexGrid1
If .Rows = 0 And .Cols = 0 Then
Exit Sub
End If
Dim lRowOriginal As Long: lRowOriginal = .MouseRow
Dim lColOriginal As Long: lColOriginal = .MouseCol
Dim l As Long
Dim lWidth As Long
For l = 0 To .Cols - 1
If .ColIsVisible(l) Then
lWidth = lWidth + .ColWidth(l)
End If
Next
If .RowHeightMin = 0 Then
m_IsOnFixedPart = (x < .ColWidth(0)) Or (x > lWidth) Or (y < .RowHeight(0))
Else
m_IsOnFixedPart = (x < .ColWidth(0)) Or (x > lWidth) Or (y < .RowHeight(0)) Or (y > .Rows * .RowHeightMin)
End If
m_IsZeroRow = (.RowHeight(0) >= y)
If Not m_IsOnFixedPart Or m_IsZeroRow Then
UnSelectAllGridRows
.Row = lRowOriginal
.Col = lColOriginal
Else
If (Shift And vbShiftMask) = vbShiftMask Then
SelectionOneAfterTheOther
ElseIf (Shift And vbCtrlMask) = vbCtrlMask Then
SelectUnSelectGridRow
Else
UnSelectAllGridRows
.RowSel = .Row
.ColSel = .Cols - 1
.CellBackColor = vbHighlight
.CellForeColor = vbHighlightText
End If
End If
End With
End Sub
Private Sub UnSelectAllGridRows()
Dim lRowOriginal As Long
With MSHFlexGrid1
lRowOriginal = .Row
.Row = .FixedRows
.Col = .FixedCols
.RowSel = .Rows - 1
.ColSel = .Cols - 1
.FillStyle = flexFillRepeat
.HighLight = flexHighlightNever
.CellBackColor = .BackColor
.CellForeColor = .ForeColor
.Row = lRowOriginal
.ColSel = .Cols - 1
End With
End Sub
Private Sub SelectionOneAfterTheOther()
Dim lRow As Long
Dim lMouseRow As Long
With MSHFlexGrid1
lRow = .Row
lMouseRow = .MouseRow
.FillStyle = flexFillRepeat
.Row = lRow
.Col = .FixedCols
.RowSel = lMouseRow
.ColSel = .Cols - 1
.HighLight = flexHighlightNever
.CellBackColor = vbHighlight
.CellForeColor = vbHighlightText
End With
End Sub
Private Sub SelectUnSelectGridRow()
With MSHFlexGrid1
.Row = .MouseRow
.FillStyle = flexFillRepeat
.Col = .FixedCols
.ColSel = .Cols - 1
.HighLight = flexHighlightNever
If .CellBackColor = vbHighlight Then
.CellBackColor = .BackColor
.CellForeColor = .ForeColor
Else
.CellBackColor = vbHighlight
.CellForeColor = vbHighlightText
End If
End With
End Sub
Can anybody tell me how can I delete dhe records in a table like in flexgrid selected rows? I want the code for cmdDelete:
cnn.Execute "delete from Table where ID='" .....flexgid selected rows
Thanks in advance.
Multiple Rows Of Same Content In A Table?
I have a table for inventory. It works by having a row for each item in stock. So, say you had four High Def TVs, even of the exact same model, there would be four rows. This is because each "high def tv" has its own serial number, and it makes it easy to track serials. However, some products I have like, uh, magazines, don't have serial numbers. So, if I have 20 magazines in stock, there's 20 rows that serve no purpose. Now, I don't mind having these 20 rows, but when I display my inventory in a datagrid, there's 20 rows that don't need to be there. Is there any way I can have one row, but still have it show how many rows there would be for that item?
If you don't understand please ask and I'll try to rephrase.
Thanks!
How To Select Multiple Rows In MSHFlexGrid
Dear all,
can any body help me in find the code to select multiple rows in MSHFlexGrid control.
it is also better if u find a code to test the clicked row in MSHFlexGrid... if it is selected then make it unselected. if it is not selected then make it selected.
and i want to retrieve only the selected rows in another MSHFlexGrid at another form.
plz help me to find the solution b/c i need it very urgent.....
many thanx for u
Best Regards,
Senior Developer
Listview - Multiple Selected Rows Help
Hi, I'm working on a way for a user to group up items in a database. I'm using a listview, but I was wondering if there might be a better way.. I'll probably run into many problems along the way, and here's the first one (besides trying to find a way to get the number of selected items without looping)..
This is what I want to happen..
I populated a listview with the contents of a database, Desc, Asset Number, Quantity.. I want the user to be able to select a groups of rows and combine them into one record in the database.. One thing is that the user can only select items either above or below a currently selected item.. What I tried doing was in the ItemClick event, try to test if the row above or the row below have been selected.. Problem is, when I use the CTRL key to select more than one row, the listview.SelectedItem.Index property is not valid.. How can I find the index of newly select row when other rows have already been selected?
Thanks
John
Help Finding Multiple Rows In Excel
Help...
I'm still new at VBS and this isn't working...
I need a VB script that checks an entered value in Cell A3 when the Command Button is pushed and searches another sheet, "Allpins", to find all matches in the A column ans copies the entire row to the same sheet with the CommanButton.
Private Sub Start_Click()
Dim lngLastRow As Long ' We'll use this to mark the last row
Dim lngLastCol As Long ' We'll use this to mark the last column
Dim strCopyFromSheet As String ' Name of the sheet to copy from
Dim strCopyToSheet As String ' Name of the sheet to copy to
Dim lngRowLoop As Long ' Used as a counter for looping
Dim lngColLoop As Long ' Used as a counter for looping
Dim lngDestinationRow As Long ' Used as a counter when copying to
Dim EnteredValue As Integer ' Value entered on Sheet4
Dim FoundValue As String
' // Here I'll just use Sheet1 and Sheet2 to demonstrate
' Better to pass these as an argument to the sub
Worksheets("Sheet4").Range("A10:T65500").Clear
strCopyFromSheet = "Allpins"
strCopyToSheet = "Sheet4"
EnteredValue = Worksheets("Sheet4").Cells(3, 1).Value
' // Get the last row and column on the *from* sheet
lngLastRow = Worksheets(strCopyFromSheet).Cells.SpecialCells(xlLastCell).Row
lngLastCol = Worksheets(strCopyFromSheet).Cells.SpecialCells(xlLastCell).Column
' // Go through every row on the source sheet
With Worksheets(strCopyFromSheet).Range("A2:A65500")
Set c = .Find(EnteredValue, LookIn:=xlValues)
If Not c Is Nothing Then
firstAddress = c.Address
Do
IngRowLoop = c.Row
lngDestinationRow = lngDestinationRow + 10
Worksheets(strCopyToSheet).Rows(c.Value).Copy
Worksheets(strCopyToSheet).Paste Destination:= _
Worksheets(strCopyToSheet).Cells(lngDestinationRow, 1)
Set c = .FindNext(c)
Loop While Not c Is Nothing And c.Address <> firstAddress
End If ' Exit the For Loop: row was copied
End With
End Sub
Any ideas why its not working?
Delete Multiple Rows {TrueDBGrid}
I write the query based on combining 4 tables from the northwind database.I used the TRUDBGrid Control in Visual Basic.
My problem is
1)
If i Delete one row then the corresponding information in several tables also deleted.
2)How can i delete multiple rows in TrueDBGrid Control
Copy Multiple Rows From One Listview To Another
Currently I have a program form that has 2 listviews on it. It is able to copy one item from one listview to another. Now the users want to be able to copy several at once from one listview and paste into the other at point/row where they click/selected. I hope that makes sense.
Here is what I have currently for the single copy/paste type of process:
[CODE]Private Sub cmdSetSeqNum_Click()
Dim ItmX As ListItem
On Error GoTo ERR_HNDL
Set ItmX = lvwSampleMap.SelectedItem
If (ItmX Is Nothing) Then Exit Sub
ItmX.EnsureVisible
ItmX = lvwInstrPositions.SelectedItem
CheckChanges
Exit Sub
ERR_HNDL:
StandardErrorOutput Err
End Sub
[/CODE]
Any help/suggestions would be greatly appreciated and thanks in advance.
~Becky
Selecting Multiple Rows In MSflexgrid
Is there any possible way for a user to select multiple rows in a Msflexgrid? Rows that are not in consecutive order. for example using the cntl key.
Deleting Multiple Rows From A Listview,vb6
hi All
I am doing an application in VB6 in which i have a ListView. I have four columns and some rows of data.
i have checked the option "Multi Select" and also "Checkboxes".
I have to select multiple rows by checking the check boxes and delete all the checked rows.
Can someone tell me how to delete multiple rows
Thanks in advance
Regards
Rajmv
Append Multiple Rows In Excel
Hi.
I've been reading the Excel posts and have found the post where you can append one row at a time to an excel file, from which I've created the following
Code:
Dim strZ As String, strX As String
Dim x As Long, y As Long, z As Long
Worksheets("PPS").Activate
Range("A1").Select
x = ActiveSheet.UsedRange.Rows.Count
Worksheets("NB").Activate
Range("A1").Select
y = ActiveSheet.UsedRange.Rows.Count
'move data from NB to PPS - one row at a time
'start z at 2 so not to include header
For z = 2 To y
If z > y Then Exit For
strZ = "A" & z
strX = "A" & x + 1
Sheets("NB").Select
Range(strZ).Select
Selection.EntireRow.Select
Selection.Copy
Sheets("PPS").Select
Range(strX).Select
ActiveSheet.Paste
x = x + 1
Next z
This works fine for a small number of rows to append; however, in many instances I've got 500 to over 1,000 rows of data to append.
Can someone help me with this? Thnx!
Mail Merge Multiple Rows
I have created a SQL View that contains Contact details and any associated Land Interests (Address lines). A Contact can be associated to many pieces of land so the view contains duplicated contact details if more than one piece of land. What I am trying to do is create a Mail merge document to show the contact detail once at the top of the document and show all associated pieces of land as the Re part of the document, any suggestions would be greatly appreciated.
Selecting Multiple Rows Using FlexGrid.
I am trying to use FlexGrid (MSHFlexGrid to be precise) to simulate ComboBox functionality.
In other words, I want the user to be able to click-select multiple rows in the grid, and upon clicking submit, I want to be able to determine which rows have been selected.
True Grid Pro has some built-in functionality to do this (sets bookmarks in the recordset for selected records/rows), buit I don't want to use any 3rd party controls .
Does anyone know how this can be done using just FlexGrid and ADO recordsets?
TIA
andrej
Edited by - Andrejko on 6/14/2002 12:34:27 PM
How Can I Add Multiple Rows Of Data Into XML File
Hi,
In my VB Project i use to get data from project (means text boxes, combo boxes e.t.c.,) and i wanna load that data into xml file. For that i wrote one xml file with required nodes and i parse data through program save into xml file by using below statement.
Form1.main_obj.save fname
here fname is path of xml.
When ever i am trying to add another row means i run the program next time, simply it use to do overwrite, but i wanna append for existing data dynamically.
if i run 10 times in xml file i want 10 rows.
plz help me out
Thanks in advance
Lalitha.C
Creating New Rows With Multiple Tables
I am developing a front end for a SQL Database wich has multiple tables. My primary table "Customers" has an ID set to be an auto number a Child Table "Address" has an Identifier Id that should be the same as Customer.ID. When I try to create and Add the New rows to the tables the Address table has an error with the Id field. I am trying to figure out how to set the Address.Id to the Customer.ID that is generated when the row is added to the table. I can't Update the dataset with out having a matching Address Table. Please help
Selecting Multiple Rows In MSHFlexGrid
I have a MSHFlexGrid called MSHDataGrid1. I read data to the MSHDataGrid1 from a SQL server 2000 table. What I want to do is when the operator selects multiple rows I want to read the data. I know how to do a single row, but how do I read multiple rows from the MSHFlexGrid? Here is my code to read a single row
Me.txtShortNumber.Text = Me.MSHFlexGrid1.TextMatrix(MSHFlexGrid1.Row, 2)
Me.txtQuantity.Text = Me.MSHFlexGrid1.TextMatrix(MSHFlexGrid1.Row, 4)
Me.txtDestination.Text = Me.MSHFlexGrid1.TextMatrix(MSHFlexGrid1.Row, 5)
Deleting Rows From Multiple Tables
Hi out there,
I have a key field shared by more than one table. At some point I need to delete all rows from all the tables where this field is identical. How do I do that then in one nice quick SQL one liner?
Deleting Multiple Rows From A Listview,vb6
hi All
I am doing an application in VB6 in which i have a ListView. I have four columns and some rows of data.
i have checked the option "Multi Select" and also "Checkboxes".
I have to select multiple rows by checking the check boxes and delete all the checked rows.
Can someone tell me how to delete multiple rows
Thanks in advance
Regards
Rajmv
How Can I Retrieve Cell Values From Multiple Excel Documents In A Folder
I downloaded many xls files. I want to write a macro that reads the xls files and display them in a new empty excel file. I don't want to open each file, just get the cell values within a loop. I couldn't find an example on the internet. If you know a tutorial for visual basic appliacations for excel please let me know.
Thanks.
Trying To Filter Rows Of Multiple Word Tables
This works great but just with one table. When I try it on more than one table the row index refers to the remaining rows of table(1). It may have something to do with this statement that I found in the help files...
Found this under "Tables Collection Object" in the help files.
"The Count property for this collection in a document returns the number of items in the main story only. To count items in other stories use the collection with the Range object."
Can anyone help me out with this?
'delete unchecked rows
Sub Mac2()
Dim Rcount As Integer
Dim OneRow As Row
Dim x As Integer
For x = 1 To ActiveDocument.Tables.Count
For Each OneRow In ActiveDocument.Tables(x).Rows
If ActiveDocument.FormFields(OneRow.Index).CheckBox.Value = False Then
ActiveDocument.Tables(x).Rows(OneRow.Index).Delete
End If
Next OneRow
Next x
End Sub
THX! dowhile
How Do I Highlight Multiple Rows In Flexgrid Randomly
for example, there are 10 rows in the flexgrid and i want to select rows 1,2,4, and 8...how can i select the rows using ctrl + click? right now i'm only able to select multiple rows that are together (ex. rows 1,2,3,4).
|