snpcrd Posted April 2, 2007 Share Posted April 2, 2007 Hi,Having a problem selecting records from an Access 2003 database. With the below SQL from what I understand it should select all records in the database based on using the wildcard character '%'. SELECT * FROM Unsnooped WHERE RegionCode LIKE '%' AND ClinicGroup LIKE '%' AND Snooped LIKE '%' ORDER BY Sitecode ASC Example DB records can be found at . The rightmost field is the one called 'Snooped'. There are 1033 records in the DB but it will only display 496. All the fields that I'm trying to pull out are populated by values so I'm a bit of a loss.Cheers Link to comment Share on other sites More sharing options...
pulpfiction Posted April 2, 2007 Share Posted April 2, 2007 One possible reason is, if any values of either "RegionCode" or "ClinicGroup" or "Snooped" is NULL. Also since you have used AND between the constraint, it will not show the record is any one of these 3 values is NULL in a particular row. Link to comment Share on other sites More sharing options...
snpcrd Posted April 3, 2007 Author Share Posted April 3, 2007 One possible reason is, if any values of either "RegionCode" or "ClinicGroup" or "Snooped" is NULL. Also since you have used AND between the constraint, it will not show the record is any one of these 3 values is NULL in a particular row.Thanks Yahwey and Pulpfiction for pointing me in the right direction and clarifying the NULL problem.Solved the problem by testing for the Null (e.g. (RegionCode LIKE '%' OR IsNull(RegionCode) = True))Cheers Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now