On Mon, 27 Mar 2006 12:56:51 -0500, MLH <CR**@NorthState.net> wrote:
Danny had a good suggestion. I'm focussing on the use of OpenArgs to
pass in a form name. I prefer to do that a bit differently. I use a
querystring-like string for OpenArgs:
Docmd.OpenForm "someform",,,,,,"FormName=frmVehicleEntryForm"
The beauty is that the OpenArgs string becomes self-documenting, and
that we are re-using a format that everyone is already familiar with.
Then in the receiving form, I parse OpenArgs using a function that I
wrote once to parse any querystring into a Scripting.Dictionary
object:
dim m_dict as Scripting.Dictionary
m_dict = ParseQueryString(Me.OpenArgs)
The beauty is that OpenArgs becomes very flexible; I can add more
arguments at any time and will not get confused about what's what:
Docmd.OpenForm
"someform",,,,,,"FormName=frmVehicleEntryForm&Vehi cleID=123&DriverID=456"
-Tom.
Select Case Me.OpenArgs
Case "frmVehicleEntryForm"
Forms![frmVehicleEntryForm]![OwnerChooserBox].Requery
Case "frmEditTowedVehicleList"
Forms![frmEditTowedVehicleList]![OwnerChooserBox].Requery
End Select
Me.OpenArgs is the name of the calling form. There are only two forms
that open frmOwerEntryForm in which the above code resides. Can the
above snippet be shortened?