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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Refresh a report after assigning a value to a control

Status
Not open for further replies.

jeffcullina

Programmer
Joined
May 13, 2002
Messages
80
Location
US
I have a form button that opens a report. After it does so, it assings a value (the search criteria used to generate the report) to one of the controls on the report. I need to figure out how to refresh the report so that it shows the value that I have assigned. I have tried to repaint, refresh and requery. My code looks like this.

DoCmd.OpenReport stDocName, acPreview, , stWhere
Reports(stDocName).Controls("Path").Value = "Test"
DoCmd.RepaintObject acReport, stDocName

The last line does not do anything.
 
Why are you adding the value in at this point. I get the feeling your question is just a stripped down version of a larger question. You should try to set the value in the Open Event of the Report. You can't refresh a Report the way you can a form.

Paul
 
The only way I can tell to do that is to set up a hidden field on my form. Then from the OnOpen function in the report, I can have the report go look for the value on the form. That feels a bit hacked to me, but if you don't think I have any other options, that is what I will do.
 
Hidden textboxes are used by a great many non hacks. I wouldn't hesitate to have you pass the value that way. Once the report is opened, it's set. You can't change it or manipulate it. To do that you would have to close it and open it again so use the hidden textbox and smile, it's almost Friday.

Paul
 
Done. Thanks. I am still a hack though.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top