C
CW
I have the basic details of our invoices (which are reports) displayed on a
continuous form i.e. date, number, customer, amount. At the end of each row I
have a button so that we can open the form on which the invoice was created,
to modify it. That works fine, it opens the selected invoice.
I also have a button that should open a preview of the selected invoice
(rpt). However, I can't get this to fire the correct record - it insists on
opening the last (most recently created) invoice, no matter on which line the
record selector may be.
This is the code I am using on the Click event of that button:
Private Sub cmdPreviewInvoice_Click()
On Error GoTo Err_cmdPreviewInvoice_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "rptInvoicePrint"
stLinkCriteria = "[InvNo]=" & Me![InvNo]
DoCmd.OpenReport stDocName, , , stLinkCriteria, acPreview
Exit_cmdPreviewInvoice_Click:
Exit Sub
Err_cmdPreviewInvoice_Click:
MsgBox Err.Description
Resume Exit_cmdPreviewInvoice_Click
End Sub
Where am I going wrong??
Thanks a lot
CW
continuous form i.e. date, number, customer, amount. At the end of each row I
have a button so that we can open the form on which the invoice was created,
to modify it. That works fine, it opens the selected invoice.
I also have a button that should open a preview of the selected invoice
(rpt). However, I can't get this to fire the correct record - it insists on
opening the last (most recently created) invoice, no matter on which line the
record selector may be.
This is the code I am using on the Click event of that button:
Private Sub cmdPreviewInvoice_Click()
On Error GoTo Err_cmdPreviewInvoice_Click
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "rptInvoicePrint"
stLinkCriteria = "[InvNo]=" & Me![InvNo]
DoCmd.OpenReport stDocName, , , stLinkCriteria, acPreview
Exit_cmdPreviewInvoice_Click:
Exit Sub
Err_cmdPreviewInvoice_Click:
MsgBox Err.Description
Resume Exit_cmdPreviewInvoice_Click
End Sub
Where am I going wrong??
Thanks a lot
CW