Full Version: Run command button when form opens
UtterAccess Forums > Microsoft® Access > Access Forms
EssKayKay
Is it possible to open a form from a form and automatically run a Command button (not the command) on the second form?
That is, from From1 you click a button that opens Form2 and automatically clicks a command button on Form2 called cmdPrint?
Thanks,
SKK
theDBguy
Yes, it's possible, and there are a few ways to do this. Here' s one:
On the Open event of Form2, add the following code:
If IsNull(Me.OpenArgs) Then
'form was opened normally
Else
Select Case Me.OpenArgs
Case "Form1"
Call cmdPrint_Click
End Select
End If
Then in the click button of Form1, put the following code:
DoCmd.OpenForm "Form2", , , , , , "Form1"
HTH
EssKayKay
Excelent - I will try this.
Thank again,
SKK
theDBguy
You're welcome. Good luck.
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.