Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Display Records Where Specified Field is NOT NULL?
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Display Records Where Specified Field is NOT NULL?

 Post Reply Post Reply
Author
kennywhite View Drop Down
Groupie
Groupie


Joined: 26 February 2009
Location: Indy
Status: Offline
Points: 106
Post Options Post Options   Thanks (0) Thanks(0)   Quote kennywhite Quote  Post ReplyReply Direct Link To This Post Topic: Display Records Where Specified Field is NOT NULL?
    Posted: 19 July 2011 at 5:28pm
In my SQL statement I want to display records where a particular field is NOT NULL. Seemed like it should be very simple...

I looked around a bit and all I've been able to find is using 
WHERE field IS NOT NULL
 
or 
WHERE field NOT NULL
 

Neither of these have worked for me. Can someone let me know what I am doing wrong?

Here is my current SQL statement. I am using an MS Access Database.

strSQL = "SELECT * FROM irr, orders WHERE irr.ID = orders.IRRID AND irr.CLOSED = false AND Serials = IS NOT NULL ORDER BY irr.ID;"

I get this error:

Error Type:
Microsoft JET Database Engine (0x80040E14)
Syntax error (missing operator) in query expression 'irr.ID = orders.IRRID AND irr.CLOSED = false AND Serials = IS NOT NULL'.


If I drop the "IS" and just leave it as "NOT NULL" I just get a blank page returned to me. 
Back to Top
WebWiz-Bruce View Drop Down
Admin Group
Admin Group
Avatar
Web Wiz Developer

Joined: 03 September 2001
Location: Bournemouth
Status: Offline
Points: 9844
Post Options Post Options   Thanks (0) Thanks(0)   Quote WebWiz-Bruce Quote  Post ReplyReply Direct Link To This Post Posted: 20 July 2011 at 7:58am
Try the following:-


strSQL = "SELECT * FROM irr, orders WHERE irr.ID = orders.IRRID AND irr.CLOSED = false AND Serials IS NOT NULL ORDER BY irr.ID;"

Back to Top
kennywhite View Drop Down
Groupie
Groupie


Joined: 26 February 2009
Location: Indy
Status: Offline
Points: 106
Post Options Post Options   Thanks (0) Thanks(0)   Quote kennywhite Quote  Post ReplyReply Direct Link To This Post Posted: 20 July 2011 at 3:11pm
Thanks! 

I get a few blank results back, but I'm thinking maybe those records could have a blank space in the field. 
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.