Well, actually, how have you for years picked what form called another form?
You don't need to pass openargs, and FOR SURE you don't want to use global
vars as suggested (that just makes for buggy code..and what happens if you
need two forms open!!!).
You can pick up the previous forms name in the on-open event of a form, and
EVEN AS LATE AS THE ON-LOAD event....
Until those events actually finish, the form is not yet loaded.
So, lot of my code has a form module level garble called
frmPrevious
So, in my on-open event of the form I go:
set frmPrevious = screen.Activeform
Now, anywhere in that forms code, I h ave a ready made reference to the
previous calling form
msgbox "name of called form is " & frmPrevous.Name
Or, to requery he calling form
frmPrevious.Requery
So, as a coding standard, I have a ready made "feature" that gives me
complete use of the calling form.....
However, this wonderful suggestion DOES NOT work for reports..and if your
report is opened in NON preview mode, then you can't use screen.ActiveForm
in the reports on-open event as above.
So, at this point, I think I would actually use open args...and pass two
values....
dim strArges as string
strArges = me!CustomerID & "~" & me.name
docmd.OpenReport "MyReport",acViewPreview,,,,strArgs
Then, in your reports on open, you go:
lngCustoerID = split(me.openArgs,"~")(0)
strFormPrevous = split(me.OpenArgs,"~")(1)
frmPrevous = forms(strFromPrevous)
So, I just split out the prams passed...and as above...I *still* get my nice
frmPrevous that all reports, forms have in code now!!!
Hence
frmPrevious!LastName = "kallal"
frmPrevous.MyCustomPrint
So, we still have a full reference variable to the previous "calling" form
in the report that we can requery, or run code, or do whatever we want with
that "prevous" form....