I have an Invoice input form to create a Invoice. Another table called customers is auto populated in the Invoice table. When I click the cmdPrintReport button I have created it prints nothing. Is there anything I can do to make this work?
I have an Invoice input form to create a Invoice. Another table called customers is auto populated in the Invoice table. When I click the cmdPrintReport button I have created it prints nothing. Is there anything I can do to make this work?
Not much to go on. Does the report show the correct record if opened from the database window? What is it based on (table or query)? What is the code behind the button? Has the invoice been saved prior to printing?
Hi its based on a table. When I select to print all records on the db window it prints details except the Populated data. Invoice has been saved. Here is the code.
Private Sub cmdPrintRecord_Click()
Dim strReportName As String
Dim strCriteria As String
strReportName = "rptPrintRecord"
strCriteria = "[CustomerName]='" & Me![CustomerName] & "'"
DoCmd.OpenReport strReportName, acViewPreview, , strCriteria
End Sub
That code will restrict the report to the customer displayed on the form (as you probably know). If you're saying it prints other details but not the details on the form, it sounds like the data on the form hasn't been saved yet. Try adding this line before the OpenReport line:
If Me.Dirty Then Me.Dirty = False
Sorted. I changed it to a Query type REport and its done it. Thanks
Glad you got it sorted.