Bitwise XOR

  • Thread starter Thread starter Sylvie
  • Start date Start date
S

Sylvie

Hi everyone

I need to buid a field F1 wich is the bitwise XOR
of the Field of integer F0 in a query .

How can I do this with Access 2002 ?

Sylvie
 
Hi everyone

I need to buid a field F1 wich is the bitwise XOR
of the Field of integer F0 in a query .

How can I do this with Access 2002 ?

Sylvie

Eh? XOR takes TWO operands - what do you mean by "the bitwise XOR
of... F0"?

I think you'll need a VBA function. There was an undocumented BXOR
operator - [F1] BXOR [F2] - in some versions of Access but I think
that didn't make it into 2002.

XOR is a valid VBA operator, though, so you could write a function

Public Function BXOR(i1 As Integer, i2 As Integer) As Integer
BXOR = i1 XOR i2
End Function
 
By "bitwise XOR", you mean flip all the bits?

Try the NOT operator:
F1 = NOT F0

In the context of an update query, use the BNOT operator under ADO:
strSQL = "UPDATE MyTable SET F1 = BNOT F0;"
CurrentProject.Connection.Execute strSQL
 
Back
Top