I need to simulate the act of clicking on a form’s button from within VBA code. In Access VBA Help I came upon the RaiseEvent statement and assumed that this is the way to do it. Following the instructions in that topic, I tried to raise the event cmdCancel_Click as follows:
1. I declared the event at the module level of the class module of that form:
Event cmdCancelClick()
Note 1. Error Help says to omit the _ between cmdCancel and Click.
Note 2. I don’t know if the declaration requires arguments.
2. In code I insert the following statement:
RaiseEvent cmdCancelClick
Note 1. Using the de###### I can tell that the statement gets control.
Note 2. Absolutely nothing happens. The system just continues to run.
Is this the right way to simulate the user clicking on the cmdCancel button? If it is, please tell me what I’m doing wrong. If it is not, please tell me what I should be doing.
Thank you, John Littell