Dim sCrit$
If Not IsNull(Forms![Search Form]![Project Number]) then
sCrit = sCrit & iif(sCrit<>""," AND ","")
sCrit = sCrit & "Invoices.ProjectNo='" & _
Forms![Search Form]![Project Number] & "'"
End If
If Not IsNull(Forms![Search Form]!Vendor) then
sCrit = sCrit & iif(sCrit<>""," AND ","")
sCrit = sCrit & "Invoices.Vendor='" & _
Forms![Search Form]!Vendor & "'"
End If
If Not IsNull(Forms![Search Form]![Puchase Order]) then
sCrit = sCrit & iif(sCrit<>""," AND ","")
sCrit = sCrit & "Invoices.PO='" & _
Forms![Search Form]![Puchase Order] & "'"
End If
If Not IsNull(Forms![Search Form]![Invoice Number]) then
sCrit = sCrit & iif(sCrit<>""," AND ","")
sCrit = sCrit & "Invoices.InvoiceNumber='" & _
Forms![Search Form]![Invoice Number] & "'"
End If
If Not IsNull(Forms![Search Form]![Voucher Number]) then
sCrit = sCrit & iif(sCrit<>""," AND ","")
sCrit = sCrit & "Invoices.Voucher='" & _
Forms![Search Form]![Voucher Number] & "'"
End If
If Not IsNull(Forms![Search Form]!Amount) then
sCrit = sCrit & iif(sCrit<>""," AND ","")
sCrit = sCrit & "Invoices.Amount=" & _
Forms![Search Form]!Amount
End If
DoCmd.OpenReport "myReport", acViewPreview, sCrit