PDA

View Full Version : [SOLVED:] Open a Subform Based on the Current Record



Mattheus
01-23-2020, 06:46 AM
Users navigate through my database with a navigation form. I want to have a button that opens a different subform based on the current record. I can get the main version of the form to open with the OpenForm command like so

DoCmd.OpenForm "FormName", , ,"RecordID = " & Me.RecordID

However, I can only get this to open the main form. I can't seem to figure out the syntax to have Access open the form as part of the navigation form. The only solutions I've been able to find don't relate to navigation subforms.

Thanks in advance for any help or advice!

OBP
01-25-2020, 10:37 AM
The subform should be on the mainform and use Master/Child Links to display the same record.

Uncle Gizmo
02-03-2020, 06:27 AM
Re >>>The only solutions I've been able to find don't relate to navigation subforms<<<


I have no experience with navigation forms because I was always advised never to use them! I think this is what you have discovered, they don't work well with Code. Could you change over to the normal Subform/Subreport Control arrangement?

Mattheus
02-06-2020, 11:41 AM
Looks like that will be the only option. Thanks for the assistance!