subform question

BobJones

Registered User.
Local time
Today, 05:56
Joined
Jun 13, 2006
Messages
42
I have a search form which displays the results in a subform (datasheet style). I want to be able to double click on a row in search results subform and another form load up and its data be retrieved based on the ID in the subform. But I cant figure out what to put in the VBA to get the current row or the data of the ID cell for that row.

Sorry if this appears a bit garbled, I'm not the best at writing my thoughts down!
Thanks in advance!
Bob
 
similar/same as the questions I posted today. still no answer for me.
 
Use a ListBox

I would suggest you add a list box to your main form. Use the SQL from your current search query and add it to the rowsource of the listbox.
Make sure that the bound column of your list box is the ID you wish to use to filter the form that opens.

Add the following code to the double click event of the list box:

Code:
DoCmd.OpenForm "frmYourFormName"
        
        Set rs = Forms!frmYourFormName.Recordset.Clone
        rs.FindFirst "FormID = " & Me.Listbox
        Forms!frmYourFormName.Bookmark = rs.Bookmark

(Code taken from an example db by GumbyD and OldSoftBoss - see link)
http://www.access-programmers.co.uk/forums/showthread.php?t=99346&highlight=resident+database


Regards,
BF
 

Users who are viewing this thread

Back
Top Bottom