Simple query

Radion

New member
Local time
Today, 12:28
Joined
Nov 22, 2006
Messages
8
Hi there..

I need a simple query...

I want all the records to appear which have some text in that particular field. So if there is no text in that field, it won't come up. What would I need to write under that field in the query?
 
SELECT BLAH BLAH BLAH
FROM [Your Table]
WHERE ([your_text_field] <>( "" OR Null))
 
With all respect to rainman, I don't think his syntax will work (I might be wrong). You can try this

SELECT BLAH BLAH BLAH
FROM [Your Table]
WHERE nz([your_text_field],"") <>""

Truthfully, I'm not sure you need to use the nz function, but just in case...
 
HE is correct. u cant use the "" or Null part of my example.
just use
Code:
SELECT BLAH BLAH BLAH
FROM [Your Table]
WHERE [your_text_field]<>""
NZ is not needed
 
This will also work:

Code:
SELECT Table1.Field1, Table1.Field2
FROM Table1
WHERE (((Table1.Field2) Is Not Null)) 
  OR (((Table1.Field2)<>""));
 
Last edited:
FYI, using the nz function (although not necessary in this case), effectively accomplished the same thing with less coding necessary.
nz(table1.field2,"")="" means if table1.field2 is null, then return a "", so both null and nullstring would return true in this case.
 

Users who are viewing this thread

Back
Top Bottom