Passing data to an unbound text box in a report

J

James Frater

Hello All,

We have one report that we use to display different variations of data from
the same table. For example the same report churns out bookings by week,
bookings by event, bookings by location, bookings by customer etc etc.

As part of the code for the button click would there be anyway I could pass
text to an unbound text box in the report header?

Many thanks

JAMES
 
A

Allen Browne

Assuming Access 2003 or 2007, you could use the OpenArgs of OpenReport,
e.g.:
DoCmd.OpenReport "Report1", acviewPreview, , OpenArgs:="Show this"

Then on the report, set the Control Source of a text box to:
=[Report].[OpenArgs]

For earlier versions, use a public string variable.
 
J

James Frater

Thanks Allen,

Works beautifully.

Cheers Mate

JAMES

Allen Browne said:
Assuming Access 2003 or 2007, you could use the OpenArgs of OpenReport,
e.g.:
DoCmd.OpenReport "Report1", acviewPreview, , OpenArgs:="Show this"

Then on the report, set the Control Source of a text box to:
=[Report].[OpenArgs]

For earlier versions, use a public string variable.

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

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

James Frater said:
Hello All,

We have one report that we use to display different variations of data
from
the same table. For example the same report churns out bookings by week,
bookings by event, bookings by location, bookings by customer etc etc.

As part of the code for the button click would there be anyway I could
pass
text to an unbound text box in the report header?

Many thanks

JAMES
 
Top