Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
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  
Old July 31st, 2003, 10:09 PM
peter berten peter berten is offline
Junior Member
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Posts: 9 peter berten User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
  #2  
Old August 14th, 2003, 10:35 AM
utmostrusselb utmostrusselb is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Canada
Posts: 40 utmostrusselb User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
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

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreVisual Basic Programming > Data Grid Help!


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway