Passing data from form

  • Thread starter Thread starter - Jillz
  • Start date Start date
J

- Jillz

Hi,

I have a form that creates a report, is there any way to
pass certain information from the form to the report (ie:
what the user entered in the text boxes etc)?

Thanks

Jill
 
Yes there is, in fact several ways. The way that's best depends on what you're trying to
do.

1) You can pass the value of a textbox as a Where parameter in the DoCmd.OpenReport
command.

2) You can use the OpenArgs parameter of the DoCmd.OpenReport command to pass a delimited
text string that could then be broken down and used in the report.

3) You can refer back to the control on the form from the report or the query supplying
data to the report.
Syntax: Forms!MyForm!txtMyTextbox

4) You can use code in the form to rewrite the SQL of the query supplying data to the
report, concatenating in values from the form.

#3 requires the form to be open at the time the other object tries to read from the form.
It can be hidden (Visible=No) if you prefer, just as long as it is open.
 
Back
Top