Radion
03-09-2007, 06:49 AM
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?
rainman89
03-09-2007, 07:46 AM
SELECT BLAH BLAH BLAH
FROM [Your Table]
WHERE ([your_text_field] <>( "" OR Null))
shudini
03-09-2007, 08:15 AM
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...
rainman89
03-09-2007, 09:21 AM
HE is correct. u cant use the "" or Null part of my example.
just use
SELECT BLAH BLAH BLAH
FROM [Your Table]
WHERE [your_text_field]<>""
NZ is not needed
jaxhere
03-10-2007, 08:15 AM
This will also work:
SELECT Table1.Field1, Table1.Field2
FROM Table1
WHERE (((Table1.Field2) Is Not Null))
OR (((Table1.Field2)<>""));
shudini
03-10-2007, 08:03 PM
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.