R
Ron
I'm not sure why this is not working. It is returning all records instead
of just the desired criteria:
Report Source is:
SELECT InvoiceHeader.*, InvoiceDetail.*, Trim(InvoiceHeader!fname) & " " &
Trim(InvoiceHeader!lname) AS Printname FROM InvoiceHeader INNER JOIN
InvoiceDetail ON InvoiceHeader.Recno=InvoiceDetail.InvoiceRecno;
Here is the code from my form's button:
Private Sub btnPrintNow_Click()
Dim stReportname As String
Dim stCriteria As String
stReportname = "rptInvoice"
With Me!Recno
If Not IsNull(.Value) Then
strCriteria = "[InvoiceHeader.Recno] = " & .Value
End If
End With
MsgBox strCriteria
DoCmd.OpenReport stReportname, acViewPreview, Wherecondition:=stCriteria
End Sub
The msgbox is showing the criteria to be correct, but all the records are
still being selected.
of just the desired criteria:
Report Source is:
SELECT InvoiceHeader.*, InvoiceDetail.*, Trim(InvoiceHeader!fname) & " " &
Trim(InvoiceHeader!lname) AS Printname FROM InvoiceHeader INNER JOIN
InvoiceDetail ON InvoiceHeader.Recno=InvoiceDetail.InvoiceRecno;
Here is the code from my form's button:
Private Sub btnPrintNow_Click()
Dim stReportname As String
Dim stCriteria As String
stReportname = "rptInvoice"
With Me!Recno
If Not IsNull(.Value) Then
strCriteria = "[InvoiceHeader.Recno] = " & .Value
End If
End With
MsgBox strCriteria
DoCmd.OpenReport stReportname, acViewPreview, Wherecondition:=stCriteria
End Sub
The msgbox is showing the criteria to be correct, but all the records are
still being selected.