If you do Quotes and Invoicing (or Purchase Orders and Invoicing) they generally share the same layout, the only difference being the Label identifying them. Rather than creating to reports you can change the Label Caption depending on which Form you are opening it from.
Create the Report and for the Label Caption put the name of the one that is used more often. So, for my Report I put Invoice because I print a lot more invoices than I do quotes. Make sure the Label is long enough to accommodate the character count of the longest word, i.e. Purchase Order.
In the Reports On_Open event place…
If Not IsNull(Me.OpenArgs) Then
Me.Controls("lblInvoice").Caption = Me.OpenArgs
…save and close the Report.
From the Form that you use to generate your Invoice there is nothing to do, so, go to the one that you use for Quotes. In Design Mode go to the Command Button(s) you are using for Preview (and Print, if you have one). Between the Private Sub… and End Sub enter…
Dim strCaption As String
strCaption = "Quotation"
Then depending on whether you have a WHERE clause…
No WHERE clause
DoCmd.OpenReport "rptInvoice", acViewPreview, , , , strCaption
With a WHERE clause (This sample only includes where the WHERE would go. 🙂 )
DoCmd.OpenReport "rptInvoice", acViewPreview, , strWhere, , strCaption
(Don’t forget some Error Code!) Save, close and test! All done!
40 total views, no views today