Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing Unbound Item Control Source in Report

Status
Not open for further replies.

sidpol

Technical User
Mar 13, 2006
1
US
Hi

I have created a form with an options group to generate a report. Each option has a filter and then opens the same report with the selected filter.

I would like to change the title of the report based on the option the user selected. I have tried the following code.

Select Case Me.optActivities
Case 1
varWhere = "[TableCaptain] Like '-1*'"
Reports![rptTableCaptainReport]!txtActivityCaption.ControlSource = "='Table Captain'"
DoCmd.OpenReport "rptTableCaptainReport", acViewPreview, , varWhere

When I do this, I get a Run Time Error 2451 "The Report Name rptTableCaptainReport you entered is misspelled or refers to a report that isn't open or doesn't exist. If I place the control source line after the open report code, then I get an error message stating that "You can't set the control source property in print preview or after printing has started."

I would greatly appreciate any help you can offer.

Thanks
S.
 
See "OpenArgs" in the help file.

________________________________________________________
Zameer Abdulla
Help to find Missing people
Sharp acids corrode their own containers.
 
Remember that OpenArgs is available starting with the 2002 verison.

You should be able to do something like this in the On Open event of the report in stead (referencing the form option group).

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top