M
meyerryang
How do I activate a button when a form opens?
meyerryang said:Your answer was correct, but I am trying something advanced. I have a
chart
built into the form that does some interesting counts and volumes, however
if
the User selects "Raw Data" it will take them to the form that the raw
data
can be queried on. I have gotten all the fields to fill in based on the
previous form, but I want it to run the code for the button (the button
has
almost 10 pages of code on it) when it opens.
So when I click "Raw Data" (button) it closes the Chart form and check
marks
the name of the Sales Rep in the raw data form
(Forms!RawDataForm!SalesCheckbox = -1). Now all I need to refresh the
data
is for the code to run the button code.
How do I run the code of the button from another form (the button's name
is
GO)?
Forms![RawDataForm]![GO]....
Call GO_Click() gives me an error
Douglas J. Steele said:What do you mean by activate?
Enable it?
Private Sub Form_Load()
Me.MyButton.Enable = True
End Sub
Cause the code to run as though someone had clicked on it?
Private Sub Form_Load()
Call MyButton_Click()
End Sub
Douglas J. Steele said:FIrst, you need to change the declaration of the routine in the other form
from Private Sub to Public Sub.
Then, you should be able to use
Call Forms("RawDataForm").Go_Click
provided RawDataForm is open.
--
Doug Steele, Microsoft Access MVP
(no private e-mails, please)
meyerryang said:Your answer was correct, but I am trying something advanced. I have a
chart
built into the form that does some interesting counts and volumes, however
if
the User selects "Raw Data" it will take them to the form that the raw
data
can be queried on. I have gotten all the fields to fill in based on the
previous form, but I want it to run the code for the button (the button
has
almost 10 pages of code on it) when it opens.
So when I click "Raw Data" (button) it closes the Chart form and check
marks
the name of the Sales Rep in the raw data form
(Forms!RawDataForm!SalesCheckbox = -1). Now all I need to refresh the
data
is for the code to run the button code.
How do I run the code of the button from another form (the button's name
is
GO)?
Forms![RawDataForm]![GO]....
Call GO_Click() gives me an error
Douglas J. Steele said:What do you mean by activate?
Enable it?
Private Sub Form_Load()
Me.MyButton.Enable = True
End Sub
Cause the code to run as though someone had clicked on it?
Private Sub Form_Load()
Call MyButton_Click()
End Sub
--
Doug Steele, Microsoft Access MVP
(no e-mails, please!)
How do I activate a button when a form opens?