Can't seem to get the right syntax to click a button on one form that opens another form and clicks Print button on the newly opened form
Can't seem to get the right syntax to click a button on one form that opens another form and clicks Print button on the newly opened form
use the BUILDER to select the exact path to an item.
but it will be like:
'in form1
docmd.openform "fMyForm2"
forms!fMyForm2.btnPrint_click
to open a specific record:
docmd.openform "fMyForm2",,,"[Key]=" & txtKey
MAKE SURE the button click event is PUBLIC
Code:PUBLIC btnPrint_click() ...
Try:
You will need to replace YourFormName with, yes you guessed, the name of your form.Code:DoCmd.OpenForm "[YourFormName]"Forms!YourFormName.SetFocus Call Forms.YourFormName.NameOfButton_Click
Also replace NameOfButton
You will also need to make the button OnClick procedure Public instead of Private
EDIT:
Sorry, got distracted and didn't realize that ranman256 had already replied
If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
Bob Fitzpatrick
That's it! Thanks