Link to home
Start Free TrialLog in
Avatar of Venkatagiri
Venkatagiri

asked on

SQL for yes/no type data

I have an access table with yes/no data type.  Each of the fields in the table has a box, which can be checked (presumably meaning "yes") or unchecked (i. e. empty presumably meaning "no").  An attempt to query this data table produced the following error.  I guess there is another way to form queries with this data type.  Please help.

SQL Statement:
SELECT * FROM tblLinkNames WHERE P6 = 'Yes'

Error:
Microsoft OLE DB Provider for ODBC Drivers error '80040e21'

The request properties can not be supported by this ODBC Driver.

/infopages/search_results.asp, line 44
Avatar of toesable
toesable

SELECT * FROM tblLinkNames WHERE [P6] = Yes

I believe, and I could be wrong if you really are going through ODBC, that the only problem with your SQL is that you have apostrophies around yes.  The above works in my database.

Maybe someone else will have an idea if this doesn't work.
This works try it.
SELECT * FROM tblLinkNames WHERE P6 = Yes
one other option is to use the numeric value for yes which would be -1 or no would be 0
ASKER CERTIFIED SOLUTION
Avatar of Trygve
Trygve

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Absolutely correct Trvqve.  toe
Actually the name is Trygve, but the underline used for URLs here at EE makes it easy to do mistakes. I have posted a suggestion to change the underline format so that it does not "messes with our logins" :-)) https://www.experts-exchange.com/bin/Q.10298381
Avatar of Venkatagiri

ASKER

Thanks for all your comments.  The solution offered by Trygve was the most general and it worked for me.  Some of the other solutions offered would also probably work in this particular situation.  Thanks for your help.  I have allocated the points to Trygve.
Thank you!