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...
Yahweh 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 The WHERE clause is superfluous increases unnecessary overhead if you're trying to select all records. Do this instead:SELECT * From Unsnooped 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.I don't use Access a lot, but I'm pretty sure your problem traces back to MS Access' handling of nulls. A null is not the same as an empty string, so if one of your RegionCode, ClinicGroup, or Snooped fields contains null data, it won't be returned in your dataset. 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