View Full Version : not evaluating True/False properly


Dylan Snyder
06-06-2008, 11:13 AM
I recently added a bit field to an SQL table. The table already had bit fields in it before that worked properly. I added a new one. In access, when I run a query on it, no records are returned when I enter anything as a criterion. True, False, o, 1...doesn't matter. when I leave the criterion blank, all the records show. All other bit fields on this table work properly. has this happened to anyone else?

boblarson
06-06-2008, 11:15 AM
In SQL Server the bit is 0 or 1, in Access False is 0 and True is -1 so you have to massage things a bit to get them to work together.

Dylan Snyder
06-06-2008, 11:19 AM
Thanks, good to know
so simply adding True or False will no longer work? Oddly enough, it looks like it shows the appropriate records when I select Is Null.

Dylan Snyder
06-06-2008, 11:19 AM
also, I'm writing queries graphically, not in SQL

boblarson
06-06-2008, 11:21 AM
Have you tried just using

False

or

Not False

Dylan Snyder
06-06-2008, 11:22 AM
yep---Is Null and Is Not Null work for True and False. I'm thinking maybe I should get back into enterprise manager and delete/add the field again.

boblarson
06-06-2008, 11:23 AM
I would just add it as a small integer and then storing 1 or -1 or 0 won't matter.

Dylan Snyder
06-06-2008, 11:26 AM
thanks,
So I can change to small integer and then set it up as True false in Access and it will accomplish what I'm trying to do? I have set up many bit fields and they appear to work. I guess the server picked this one to mess up.

boblarson
06-06-2008, 11:28 AM
Yes, we are currently doing that on a job I am working on and it works fine.

Dylan Snyder
06-06-2008, 11:30 AM
Thanks for your help. I'll just change to small integer and all should be well. Thanks!

Dylan Snyder
06-06-2008, 11:31 AM
I tried to improve your rep but I guess you helped me last time on a project so I can't. Thanks nonetheless

boblarson
06-06-2008, 11:32 AM
I tried to improve your rep but I guess you helped me last time on a project so I can't. Thanks nonetheless

Yeah, you'll have to give out rep points to at least 10 (I believe) different people before you can give it to the same person again. Hey, but when you have, feel free to come back and give me more :D