The remainder of this chapter will apply all of the information covered in the previous sections to get you started on the automation of Access Forms. The examples are in no particular order and do not rely on each other for reader comprehension. In case an example is associated to another, it will be noted. This allows for the reading of only the property examples that are pertinent to you.
The Form Open event property triggers whenever a form is opened. Each form is only opened once, so this event should theoretically trigger only one time. ("Theoretically" is used here because there are cases when events should fire only once, but they end up firing more than once. Don't take this warning too seriously, but if you suddenly have trouble with a procedure, trace it and see if this is happening.)
In the OpenForm method of the DoCmd object, there is a parameter called OpenArgs that will allow you to pass a string to the called Form. There is no structure to the parameter value, other than it needs to be a string.
For example, the following will open the form called Orders and pass it the string value.
Docmd.OpenForm "Orders", OpenArgs:="CallingProc | MainMenu"
When the form opens, you can examine the OpenArgs property using the Me object. See the earlier section You Talking to Me? for more information. The following example will examine the OpenArgs property of the form, and react to ...