I have a table which contains an answer. This answer is a combination of a set list of numbers. (see below)
Possible values
2 4 8 16 32 64
If I have the answer of Answer 24 – I need some method to work out the only values that could have been selected are 16 and 8. I am told if this where SQL I would use a bitwise operation.
I am fairly advance in Access but tend not to use VBA code, but am open to all ideas.
Compare KB194206 (the gist of it: "The Microsoft Jet database engine does not support bitwise operations in SQL. This behavior is by design."), which basically means you're stuck with VBA.
And bitwise in VBA is very simple, because in VBA all locical operators are bitwise.
Just create a wrapper function:
and use it in your SQL
Do the same thing for the other bitwise operations you need.
You could use it in joins, as well. Assume you have an
FlagsTable (FlagValue, FlagName)
that contains the names for each of your available flags:This query would be one way to address your "24 consists of 16 and 8" sub-question.