Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Checking for certain empty fields??

Status
Not open for further replies.

cyprus106

Programmer
Apr 30, 2001
654
I've got this chunk of code that checks a table and looks for certain things. There's one more Column in the table, labled 'Type'. I only want to select the fields whose types are empty and don't contain characters, but when I say something along the lines of "...AND Type = ' '", "...AND Type = ''" or "...AND Type = NULL" they never select the fields in which Type is empty. In fact, when I add any of those 3 lines in, it doesn't select ANY records. I need to select the record where Type is empty but I don't know how to do it!!

set rsCars = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT * FROM CarList WHERE Model = '" & tempstr(1) & "' AND Years = '" & tempstr(0) & "'"
rsCars.Open strSQL, objConn


if Not rsCars.EOF then
'do some stuff
end if



Cyprus
 
Hai...
Why can u use the IdEmpty function?
IsEmpty(expression)
Determines whether the variable has been initialized.
 
you are trying to test empty/null on a sql result set right?


Select * from carlist where model IS NULL

if your field name is actually called "type" and the is null doesn't work, then try putting brackets around it because type is usually a reserved word

select * from carlist where [type] IS NULL

one of those should work if i got what you are asking..
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top