Changing Unbound Field on a Report

  • Thread starter Thread starter Joe Williams
  • Start date Start date
J

Joe Williams

Hi!

I have a form that calls a report through a command button. Along with
calling up the report, I would like to set an unbound field on the report to
a text string that I choose. I would create an IF statement in the code that
calls the report up to determine the right string, then I want to be able to
send this string to an unbound field and have it print on the report.

Is there a way to do this? Thanks and have a happy new year!

- joe
 
If you're using ACCESS 2002 or higher, you can use the OpenArgs argument of
the DoCmd.OpenReport code step to pass this text string along to the report:

DoCmd.OpenReport "ReportName", , , , , "TextString"

In the report's OnOpen event, you can then set the value of that unbound
control to the OpenArgs property:

Me.TextBoxName.Value = Me.OpenArgs

If you're using an older version of ACCESS, then you'd need to write the
value of the text string to a control on the form (can be hidden), and then
have the report read that control's value.
 
Back
Top