Search code examples
ms-accessfilterreportwhere-clauserecord

Print Preview to Current record on form access


I have a button on my form that creates a print preview of my report. I can not get it to open on the same record as the current form. Instead it opens to the first record. They are both on the same query. I tried both macros and VBA. I'm new to access and cant understand how to get my records to be the same and print preview just the record I had open in my form

Here's my VBA code,I get error saying "no messsage for this error"

    DoCmd.OpenReport "Moisture", acViewPreview, , "[Order Number]= " & [Order Number]

Solution

  • Try:

    DoCmd.OpenReport "Moisture", acViewPreview, , "[Order Number]=""" & [Order Number] & """"