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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Header/Detail Datagrid Selection Question

Status
Not open for further replies.

Cranger

Programmer
Apr 4, 2001
54
0
0
US
OK, I still haven't gotten this figured out yet so I am asking it again. Please bare with me because I am very confused. Also note that I am not just asking how to do what I am trying to do, but also is there a better/easier way.

Scenerio

frmOrder - Contains header (bound to txt fields) and detail (datagrid)
clsOrder - Class module that controls my recordset.
Contains Primary (header) and Secondary
(Detail) Datamembers
frmDetail - Form I wish selected record to appear in.

My problem is this
frmOrder comes up with the correct information. All I want to do is double click on a record in my datagrid and have the frmDetail come up with that specific record.
I could pass the details record ID field Globally to the form, but I wanted to see if I could access that detail record that was double clicked in frmOrder, but have NO idea how to do that.

Comments, Suggestions?

 
Anyone??? Suggestions? Clarifications?
 
Hmmmm ...

I'm not sure that this is what you want but ...

in your Sub Form where details are displayed

Dim mvarKeyValue As String
Public Property Let (KeyValue As String)
mvarKeyValue = KeyValue
End Sub

Sub Form_Activate()
Dim SQL as String
Dim rs as ADODB.Recordset
SQL = "Select * From Details Where Key = '" & _
mvarKeyValue & "' "
rs.Open SQL, ...
' "rs" can of course be a data control recordset


In your main form containing the data grid ...

Sub DataGrid1_DblClick()
frmDetails.KeyValue = DataGrid1.Columns(0).Value
frmDetails.Show vbModal
End Sub

This at least gets you around passing Globals with all the "... now where did that get set?? ..." issues they cause.
 
Thanks Golem! That is exactly what I wanted to know!

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top