Changing Unbound Field on a Report

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
 
K

Ken Snell

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top