Accessing calling Form value

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I wanted to know:

If i've got a button (in a form) which when clicked, runs a report, but this report can be 'called' from other Forms,
How do I in the report, access values from a calling Form without directly using the form name (because that will change)?

I tried Form.Parent![variable], but that i think only works for Subforms.

-TIA
 
If you are using Access 2002 or 2003, you could use the OpenArgs of
OpenReport to pass the name of the calling form:
DoCmd.OpenReport "MyReport", acViewPreview, OpenArgs:= Me.Name

In earlier verisons, Dim a public string variable in a general module, set
it to the name of your form before using OpenReport, and then you can read
the value and clear it in Report_Open or wherever.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

R Weston said:
I wanted to know:

If i've got a button (in a form) which when clicked, runs a report, but
this report can be 'called' from other Forms,
How do I in the report, access values from a calling Form without directly
using the form name (because that will change)?
I tried Form.Parent![variable], but that i think only works for Subforms.

-TIA
 
Back
Top