I'm trying to make a preview button on an inventory form so that if a user is looking at an item of inventory they can see what invoices included that item, click on the invoice number to see the invoice report in print preview and then print or close out.
I have the database set up so that there are no close buttons on anything that is not a popup (I use added buttons to navigate). The Invoice report is usually viewed in report view with navigation buttons at the top.
So I want to temporarily set the report's popup setting to true but am having a hard time figuring out how to do this.
The code I've tried:
Code:
Private Sub ConfNum_Click() If [IsSample] = True Then
Reports!rptOrderConfSample.Report.PopUp = True
DoCmd.OpenReport "rptOrderConfSample", acViewPreview, , "[ConfNum] =" & [Forms]![frmLotDetails]![rptGramsPacksAndPriceSoldOfLot].Report!ConfNum
Else
Reports!rptOrderConf.Report.PopUp = True
DoCmd.OpenReport "rptOrderConf", acViewPreview, , "[ConfNum] =" & [Forms]![frmLotDetails]![rptGramsPacksAndPriceSoldOfLot].Report!ConfNum
End If
End Sub
This way I get an error that says : 'rptOrderConfSample' is misspelled or refers to a report that isn't open or doesn't exist.
Well the report isn't open yet, so that makes sense.
But, if I switch the code to open the report first it tells me that I need to open the report in design view in order to change this. Users won't be able to do that...
Any thoughts or insight?
Thanks