Bitwise AND in Access query

  • Thread starter Thread starter CJM
  • Start date Start date
In Access 2000 and later, you can use the BAND operator (Binary AND), but
only if you run the query under ADO code.

The Access interface uses DAO (the native Access language), so you can't run
the query there.
 
I believe the AND operator will do a bitwise and:

255 and 64 ---> 64

1 AND 2 ---> 0

1 AND 3 ----> 1
 
Hi,


Not in SQL.
====================================

? CurrentProject.Connection.Execute( "SELECT 255 AND 64").FIelds(0).Value
-1


? CurrentProject.Connection.Execute( "SELECT 255 BAND 64").FIelds(0).Value
64

=====================================


Hoping it may help,
Vanderghast, Access MVP
 
But you can write a simple user-defined function to do the bitwise and for you
and call that from the query.
 
Hello,

You may create a Access project, then run the following code:

? CurrentProject.Connection.Execute( "SELECT 255 & 64").FIelds(0).Value

It will return 64. I test it on my side and it works fine. I hope it's
helpful.

Sophie Guo
Microsoft Online Partner Support

Get Secure! - www.microsoft.com/security

=====================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=====================================================
This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top