Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
Dim strFilter As String
'The line below ensures that we have at least one element in the criteria,
'so that we don't get an error. Any string-type field could be used,
'or any field for which a constant criteria value is known (such as orderdate > #1/1/1980#).
strFilter = "([SalesRep] Like ""*"")"
If Forms!CustPOData!boxCustName <> "" Then
strFilter = strFilter & " And " & BuildCriteria("CustName", dbText, Forms!CustPOData!boxCustName)
End If
If Forms!CustPOData!boxCustPO <> "" Then
strFilter = strFilter & " And " & BuildCriteria("CPOID", dbText, Forms!CustPOData!boxCustPO)
End If
If Forms!CustPOData!boxWorkOrder <> "" Then
strFilter = strFilter & " And " & BuildCriteria("WorkOrderNum", dbText, Forms!CustPOData!boxWorkOrder)
End If
If Forms!CustPOData!boxRMA <> "" Then
strFilter = strFilter & " And " & BuildCriteria("RMANum", dbText, Forms!CustPOData!boxRMA)
End If
If Forms!CustPOData!boxProdID <> "" Then
strFilter = strFilter & " And " & BuildCriteria("ProdID", dbText, Forms!CustPOData!boxProdID)
End If
If Forms!CustPOData!boxManufPN <> "" Then
strFilter = strFilter & " And " & BuildCriteria("ManufPN", dbText, Forms!CustPOData!boxManufPN)
End If
If Forms!CustPOData!Date1 <> "" Then
strFilter = strFilter & " And " & BuildCriteria("OrderDate", dbDate, ">=" & Forms!CustPOData!Date1)
strFilter = strFilter & " And " & BuildCriteria("OrderDate", dbDate, "<=" & Forms!CustPOData!Date2)
End If
'Use the two lines below to open a query with these criteria
DoCmd.OpenQuery "queryname", acNormal, acReadOnly
DoCmd.ApplyFilter , strFilter
'Or use the line below to open a report with these criteria.
'Comment out the unneeded line(s).
DoCmd.OpenReport "reportname", acViewPreview, , strFilter
Private Sub cmdGetReport_Click()
Dim strFilter As String
If Forms!frmReports!cboLenderName <> "" Then
strFilter = "[Lender Name] Like " & Forms!frmReports!cboLenderName
DoCmd.OpenReport "rptSuspended", acViewPreview, strFilter
Else
'Instead of opening the unfiltered report here, you could
'open a MsgBox telling the user that s/he needs to select
'a lender name from the form.
DoCmd.OpenReport "rptSuspended", acViewPreview
End If
End Sub