On Mon, 27 Mar 2006 12:56:51 -0500, MLH <CR**@NorthStat e.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=frmV ehicleEntryForm "
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.Dicti onary
object:
dim m_dict as Scripting.Dicti onary
m_dict = ParseQueryStrin g(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=frmV ehicleEntryForm &VehicleID=123& DriverID=456"
-Tom.
Select Case Me.OpenArgs
Case "frmVehicleEntr yForm"
Forms![frmVehicleEntry Form]![OwnerChooserBox].Requery
Case "frmEditTowedVe hicleList"
Forms![frmEditTowedVeh icleList]![OwnerChooserBox].Requery
End Select
Me.OpenArgs is the name of the calling form. There are only two forms
that open frmOwerEntryFor m in which the above code resides. Can the
above snippet be shortened?