Parameter query - blank fields

G

Guest

I have a parameter query that I find does not work if the relevant date field
(i.e. in the table) is left blank. The query only works when a date is
entered in all records.
Any suggestions welcome (Thanks for the help thus far Allen Browne!). A
portion of the sql query is pasted below;

WHERE (Company.Company Like Forms![Find ILS Invoice]!Company & "*")
And (Manufacturer.Manufacturer Like Forms![Find ILS Invoice]!Manufacturer &
"*")
And (AuditCAP.CAPNumber Like Forms![Find ILS Invoice]!CAP & "*")
And (Company.Company Like Forms![Find ILS Invoice]!Company & "*")
And ((Forms![Find ILS Invoice]!StartDate) Is Null) Or (Forms![Find ILS
Invoice]!EndDate Is Null) Or (InvoiceILS.[London Invoice Date] Between
Forms![Find ILS Invoice]!StartDate And Forms![Find ILS Invoice]!EndDate)
 
D

Douglas J. Steele

You could try changing

And ((Forms![Find ILS Invoice]!StartDate) Is Null) Or (Forms![Find ILS
Invoice]!EndDate Is Null) Or (InvoiceILS.[London Invoice Date] Between
Forms![Find ILS Invoice]!StartDate And Forms![Find ILS Invoice]!EndDate)

to

And ((Forms![Find ILS Invoice]!StartDate) Is Null) Or (Forms![Find ILS
Invoice]!EndDate Is Null) Or InvoiceILS.[London Invoice Date] Is Null Or
(InvoiceILS.[London Invoice Date] Between
Forms![Find ILS Invoice]!StartDate And Forms![Find ILS Invoice]!EndDate)

However, that will return the rows without a date even if you've supplied a
StartDate and EndDate. Not sure if that's what you intended.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top