Correct Expression Help

  • Thread starter Thread starter JCrowe
  • Start date Start date
J

JCrowe

I have a field that contains a possiblity of three
different values:

1. Field is empty (no data entered)
2. The word "FREE"
3. An invoice number

What I would like to do is build my query so that the
empty records and FREE records are not pulled up. Just the
records with an invoice number.

I have played with a couple of different expressions and
found that:

<> Free

Excludes both empty records and Free record. My question
is why ? And is this a safe way to go or is there
something better ?

Thanks,
JCrowe
 
JCrowe said:
I have a field that contains a possiblity of three
different values:

1. Field is empty (no data entered)
2. The word "FREE"
3. An invoice number

What I would like to do is build my query so that the
empty records and FREE records are not pulled up. Just the
records with an invoice number.

I have played with a couple of different expressions and
found that:

<> Free

Excludes both empty records and Free record. My question
is why ? And is this a safe way to go or is there
something better ?

Thanks,
JCrowe

From the fact that the field can contain the word "FREE", I conclude
that the field in question is a text field. As such, something like
this might do the job on the criteria line in the query design grid:

<> "FREE" And Is Not Null
 
I have played with a couple of different expressions and
found that:

<> Free

Excludes both empty records and Free record. My question
is why ? And is this a safe way to go or is there
something better ?

Just for clarity and self-documentation I'd be inclined to use a
criterion of

<> "Free" OR IS NULL

The null records will fail any comparison: NULL is not equal to
anything, nor is it UNequal to anything, so your criterion will indeed
work correctly. My suggestion will work too and may be a bit easier to
understand when you come back to this query later!
 

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

Similar Threads

No Primary Key! 4
Apply Pament to invoices in form 0
DLookup and Nz 0
Part Autonumber 2
Access Access variable string for export 0
Query to include null values 8
Table normalization 1
How to auto-post editable lookups? 2

Back
Top