Scott Palmer
asked on
I need to run vba code in a subform from the main form
The main form has a button to find a record. I have a subform on the main form that has vba code to open a recordset and show a list of records. I would like that to happen when I click on the button on the main form.
I just need the code to be able to reference the vba in the subform from the main form so it will run.
Main form name: frmMain
Subform name: frmFCDBHeader
The code that needs to be called n the subform is: Public Sub FCDB()
Thanks,
Scott
I just need the code to be able to reference the vba in the subform from the main form so it will run.
Main form name: frmMain
Subform name: frmFCDBHeader
The code that needs to be called n the subform is: Public Sub FCDB()
Thanks,
Scott
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Is there some particular reason that you are working with unbound forms?
If the subform were bound, it's Recordsource query could reference a control on the mainform to get selection criteria:
WHERE somefield = Forms!MyForm!somefield
Then in the click event of the button, you would requery the subform.
Me.sfrmName.Requery
If the subform were bound, it's Recordsource query could reference a control on the mainform to get selection criteria:
WHERE somefield = Forms!MyForm!somefield
Then in the click event of the button, you would requery the subform.
Me.sfrmName.Requery
ASKER
Thanks
Call Me!NameOfSubformControl.Fo
/gustav