I want to know if there is a way to select a record in a Subform on Form A and have it go to that record on Form B. I know you can do this using a listbox, but I am trying to get it to work with a subform.
any ideas/examples?
I want to know if there is a way to select a record in a Subform on Form A and have it go to that record on Form B. I know you can do this using a listbox, but I am trying to get it to work with a subform.
any ideas/examples?
Do subform and Form B have the same data source?
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
The subform is a query of the same data used in form B (which is based on a table). So I have a search form (form A) where you can look up information from different tables in a subform (Subform on Form A).
I want to make it so you can click (or press a button) on a record in the subform and go to that record on Form B.
Opening two forms to the same record can be problemmatic. That is like two people accessing the same record.
What do you mean by 'different tables in a subform'?
However, the code would be like:
DoCmd.OpenForm "form name", , , "ID=" & Me.ID
The trick is figuring out what event the code would go in. Could be the subform's DoubleClick event or a Button click event.
How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.
If you're saying both forms are already open, you could adapt this technique:
http://www.baldyweb.com/Bookmark.htm
by removing the OpenForm and adjusting the form references appropriately.
Thank you for all the replies. I'm going try your suggestions, and see if I can get them to work.
If both the main form and the subform are using the same recordset you can use the 'Move' clause.
I found the following you could try...
Dim lngrecordnum As Long 'Returns the current record number as LONG number.
lngrecordnum = FrmA.CurrentRecord
FrmB.Move(lngrecordnum)
I've used the .Move clause on a DAO recordset successfully in my own project
worth a shot. see if it works.