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!

Variable Report Name

Status
Not open for further replies.

Bandenjamin

Programmer
Oct 18, 2005
649
US
Hope this one is easy.

I have a report called "AnalystReviewReport". It runs off a query with a parameter for "Analyst" and "ReviewDate". I would like the name of the report to change to reflect a combination of these two names...ie "BillGeorge022807" would be the report on Bill George for 02/28/07. Any ideas on how this could be accomplished?
 
Add a textbox in the header. Set the control source to an inputbox. =inputbox("Enter Your Name and Todays Date").
 
I tried that, It just adds that to the header but does not change the name on the SNP file that is generated from the report. Sorry for leaving that part out. Been a long day :)

I did notice that if you adjust the Caption properties I get the desired result, but am having difficulty making the caption a variable.
 
On making the caption variable, I use the following in a report:

Private Sub ReportHeader_Print(Cancel As Integer, PrintCount As Integer)
Me.Caption = "Manager's Catalog - "[Forms]![ChooseZonePrint].[ChooseZonecbo].Column(2) & "/"& [Forms]![ChooseZonePrint].[ChooseSectioncbo].Column(2)
End Sub

What it does is refer to the comboboxes on the form which is used to print the report. For example if I select Zone = Bathroom Decor and Section = Faucets, the caption of the report is then "Manager's Catalog - Bathroom Decor/Faucets"

You can easily adapt the above to suit your situation.

Let them hate - so long as they fear... Lucius Accius
 
If you're using the Docmd.OutputTo method, simply change the OutputFile parameter to reflect the report name that you wish to use.
You can pick up the names from a form, or use the report to assign them to global variables, or prompt the user a second time, or...

Now that I already got carried away, how are you actually outputting the report to the .snp format?

Greg
"Personally, I am always ready to learn, although I do not always like being taught." - Winston Churchill
 
Here's the code used to generate the report and send it in an email
Code:
    Dim stDocName As String
    Dim toemail As String
    Dim SubjectLine As String
    Dim Comments As String
    
    
    
    SubjectLine = "Call Review Completed"
    
    toemail = "FM_ISHDDOC_MD"

    stDocName = "AnalystReviewReport"
    DoCmd.SendObject acReport, stDocName, acFormatSNP, toemail, , , SubjectLine

The acFormatSNP is how it is generating it as an SNP file. The report name is AnalystReviewReport. When this report runs there are two parameters that must be entered. "Analyst" and "ReviewDate". I would like for the SNP file that is attached to the email to have those parameters reflected in the file name.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top