|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
|||
|
|||
|
Data Grid Help!
I really appreciate the help, I have this code so far:
Private Sub DataGrid1_DblClick() If Not (adodc1.Recordset.EOF Or adodc1.Recordset.BOF) Then 'open form here End If End Sub I want to take the row in the datagrid that I double clicked on and put the data into a new form with editable textboxes. So if there is a row with two columns "date" and "name" then when i double click on it i want to carry that data over to a new form and have the data put into separate textboxes. i really appreciate all the help. |
|
#2
|
|||
|
|||
|
I just did this the other day. Sorry my example uses DAO, I have to because we are using an old Linux box for a server. All it does is use the RowSel method. I use i for the selected row. Then I use the 3rd column for my SQL Query. It contains the PIN number. Note that if you search with a sting in VB's SQL you need to use <single quote><double quote><& sign> string <& sign><double quote><single quote><double quote> comma and then your options or connection string if RDO.
Dim db As Database Dim Rst As DAO.Recordset Dim ws As Workspace Dim i As Integer MyConn = "C:\Path\database.mdb" i = MSFlexGrid1.RowSel ' Important line here Set ws = DBEngine.Workspaces(0) Set db = ws.OpenDatabase(MyConn) strPHN = Val(MSFlexGrid1.TextMatrix(i, 3)) Set Rst = db.OpenRecordset("SELECT RecordNo, PatFirstName as FName, PatLastName as LName, PHN, Studydate FROM TBMAIN WHERE PHN = '" & strPHN & "', dbOpenDynaset, adLockOptimistic) If Rst.Eof then msgbox "Record not found" Else 'fill text boxes from Rst recordset here' End if Hope this helps.
__________________
Best regards, Russ Bergen Senior Software Developer and Webmaster |
![]() |
| Viewing: Dev Shed Forums > Programming Languages - More > Visual Basic Programming > Data Grid Help! |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|