Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Double click DBgrid from form1 ,data will appear on another form2

Status
Not open for further replies.

hwkong1688

Technical User
Jun 5, 2010
6
Hi friends,if I double click the form1 datagrib the PLU,description and price will appear on form2 text1.text,text2.text and text3.text, how to write this code on dbgrib1.dblclick event ?

i connect my database using data control.
 
Not that I use that grid, but I can give you the basics...

The guess here is that you have a primary/foreign key relationship between two tables and when your grid is clicked on, you have access to that primary key. From there, you could call a public sub in Form2 that accepts as a paramter, that primary key to use for its lookup as the foreign key in the second table...
[tt]
Option Explicit

Public Sub DisplayChildRecords(ForeignKey As Long)
'... code goes here
End Sub
[/tt]

and you would call it from Form1 like so...
[tt]
Form2.DisplayChildRecords PrimaryKeyFromGrid
[tt]



Good Luck

 
Can provide simple example for my refence.
(e.g: form1 datagrid1 and form2 text1.text,if i double click the data row in datagrid form1 then data will appear in form2 text1.text, i really no idea how to write.
your help is high appreciated.
 
Well that is easier to do...

[tt]
Dim DataToPass As String
'retrieve the value from the datagrid
'...

'now pass the value to form2
Form2.Load
Form2.Text1.Text = DataToPass
Form3.Show
[/tt]



Good Luck

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top