Criteria Question

bsdixon

Registered User.
Local time
Today, 11:59
Joined
Nov 13, 2003
Messages
62
I have a query with criteria captured from two fields in a form.

For example:
[Forms]![ScaleLogSpreadsheet]![ComboName]
[Forms]![ScaleLogSpreadsheet]![ComboBatch]

How do I get the criteria to work so that it shows all records if both fields are blank and also works if one of the fields is blank. I believe that I need to use IsNull, but I do not know where to put this in my criteria.

Thanks.
 
=isnull([field name 1]) or isnull([field name 2])

(I think!)


You don't need the AND, because if they're BOTH null, then the OR already handles them.
 
I have the following in my criteria and it does not not show any records when I leave the combo field blank.

What am I doing wrong?

[Forms]![ScaleLogSpreadsheet]![ComboName] or IsNull([Forms]![ScaleLogSpreadsheet]![ComboName])


Thanks.
 
Something else wrong with your query then. But the one you have there isn't any good. It's like not having ANY criteria 'cause you're asking to have it whether it's null or not...

Need to send your DB? I'll give it a go. anne@vbaexpress.com
I'm not very good without seeing the DB...some people can do that. I'm way bad at it.
 
Try:

Like [Forms]![ScaleLogSpreadsheet]![ComboName]&"*"
Like [Forms]![ScaleLogSpreadsheet]![ComboBatch]&"*"

Each of these criteria statements should go under seperate columns in the query design grid while staying on the same horizontal "Criteria:" row.
 
Doug, I tried that code, but when the combo box is blank the query does not show any records.

What criteria do I need so that when the combo box is blank, all records come up?
 
That should have returned all records when either form field is empty. Do you have any other criteria in the query?
 

Users who are viewing this thread

Back
Top Bottom