preview a report base on record on form

A

AKA Sparkticus

DoCmd.OpenReport "Contractors_Invoice", acPreview, "[Invoice
Query].[InvoviceID]=" & Me![InvoviceID]

I am trying to preview a report based on the invoviceID( yeah I know itspelt
wrong) the report in based on a Invoice query

what I am trying to do is pass the value of the invoviceID so as not have
the need to type it in..

the query does the filtering

here is the code I have

at the moment the query still asks for the invoviceID any idea what I need
to change to pass this data

many thanx for any help

complete code

Private Sub Command33_Click()
On Error GoTo Err_Preview_Click
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
If IsNull(Me![InvoviceID]) Then
MsgBox "Enter purchase order information before previewing."
Else
DoCmd.OpenReport "Contractors_Invoice", acPreview, "[Invoice
Query].[InvoviceID]=" & Me![InvoviceID]
End If
Exit_Preview_Click:
Exit Sub
Err_Preview_Click:
If Err <> 2501 Then
MsgBox Err.Description
End If
Resume Exit_Preview_Click
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top