Parameter query

ScottXe

Registered User.
Local time
Today, 15:56
Joined
Jul 22, 2012
Messages
123
I have a parameter query using a form to collect the data. I put LIKE and wildcard enclosing the parameter to bypass the criteria if the data box is empty. It works well. I have another parameter of date type that uses between two dates. How can I bypass the criteria if I leave the data boxes blank? Thanks!
 
Wrap each form reference in the Nz() function, using an appropriate date for each.
 
Please show us the query SQL you are using- there may be options.
 
You may need 2 different queries...1 if null, 1 if not.
 
Please show us the query SQL you are using- there may be options.

Below is the SQL statement.

SELECT tblSKU.SKUID, tblSKU.FY, tblSKU.MainCat, tblSKU.SubCat, tblSKU.Supplier, tblSKU.Brand, tblSKU.Model, tblSKU.SKU, tblSKU.TTLSKU, tblSKU.[Product Description], tblSKU.Market, tblSKU.Handled, tblSKU.Type, tblSKU.Engineer, tblSKU.Active, tblSKU.DoCSigned
FROM tblSKU
WHERE (((tblSKU.MainCat) Like "*" & [Forms]![frmSearchCriteria]![cboMainCat] & "*") AND ((tblSKU.SubCat) Like "*" & [Forms]![frmSearchCriteria]![cboSubCat] & "*") AND ((tblSKU.DoCSigned) Between [Forms]![frmSearchCriteria]![txtStartDate] And [Forms]![frmSearchCriteria]![txtEndDate]))
ORDER BY tblSKU.DoCSigned;
 
Didn't notice my suggestion, or didn't understand it? This type of thing:

Between Nz([Forms]![frmSearchCriteria]![txtStartDate],#1/1/1900#) And Nz([Forms]![frmSearchCriteria]![txtEndDate],#12/31/2099#)
 
Hi Paul,

I now understand your suggestion fully and tried it successfully. Many thanks!
 

Users who are viewing this thread

Back
Top Bottom