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

variable name for report header

Status
Not open for further replies.

JAES

Technical User
Jul 25, 2004
100
GB
I have a generic report that prints from a form. On the form I have multiple command buttons that print the report based on a criteria. I want to add a report name in the header based on which button is clicked. Can I add it somewhere in the command line. In the example below if vevent23=-1 then I would like the header in the report rptVolunteersByCatagory to be "Great American Fundraisers"

Private Sub Command20_Click()
Dim stdocname As String
stdocname = "rptVolunteersByCatagory"
DoCmd.OpenReport stdocname, acViewPreview, , "vevent23=-1"
End Sub

Private Sub Command21_Click()
Dim stdocname As String
stdocname = "rptVolunteersByCatagory"
DoCmd.OpenReport stdocname, acViewPreview, , "vevent3=-1"
End Sub
 
You can refer to a control (such as a textbox) using the reports collection hierarchy. Why don't you just put a SELECT...CASE structure in the header format event of the report?

Gluais faicilleach le cupan làn
 
OK Thanks. I'm reading up on the Select Case function and I'll see if I can figure it out. Just another feature I didn't know about!
 
I'm having some problems understanding the SELECT...CASE structure. I've tried a few code lines in the header format event from examples but I'm just guessing. If the field vEvent1 is yes in table tabVolunteers I would like the title (test box or ?) of the report (rptVolunteerByCatagory)to say "Great American" I have 25 different choices and if someone can give me a head start I would appreciate it.
 
Sorry, I was away for the first part of the week. Yes, all filters are vEvent??. When the volunteers fill out a form they check which areas they can volunteer in. For the reports I use the vEvent?? in my where clause. A table would be the best way to go now that you mention it. Unless you have another suggestion I'll use that as my print selection drop down box and carry the proper name over to the report header. Thanks, Jeff
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top