[AccessD] brain farts

John Colby jcolby at colbyconsulting.com
Wed Oct 29 16:29:57 CST 2003


Yea, I tried that.  It still applied a true/false evaluation to the entire
thing per Gustav's email.

I have "fixed" it by creating 3 functions:

Public Function lngAND(llng1 As Long, llng2 As Long) As Long
    lngAND = llng1 And llng2
End Function
Public Function lngOR(llng1 As Long, llng2 As Long) As Long
    lngOR = llng1 Or llng2
End Function
Public Function lngXOR(llng1 As Long, llng2 As Long) As Long
    lngXOR = llng1 Xor llng2
End Function

Then I build up the SQL statement.  An actual statement looks like:

UPDATE MsysForms SET [FRM_GroupOpen] = lngOr([FRM_GroupOpen], 1),
[FRM_GroupVisible] = lngOr([FRM_GroupVisible], 1), [FRM_GroupEdit] =
lngOr([FRM_GroupEdit], 1), [FRM_GroupAddRec] = lngOr([FRM_GroupAddRec], 1),
[FRM_GroupDelRec] = lngOr([FRM_GroupDelRec], 1) WHERE (((MsysForms.FRM_ID)
In (28,34,33,35,32,29,31,30)));

Of course the 1 in the longor() function call is a bit value being ored in.

John W. Colby
www.colbyconsulting.com

-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com]On Behalf Of Stuart
McLachlan
Sent: Wednesday, October 29, 2003 5:09 PM
To: Access Developers discussion and problem solving
Subject: Re: [AccessD] brain farts


Sorry about my last post.  I thought I was still scanning the Access-
SQL list messages :-(

Try  a CINT([MsysForms]![frm_GroupOpen] ) to force it to an integer.

On 29 Oct 2003 at 14:11, John Colby wrote:

> Folks,
>
> I'm trying to do boolean operations in a query.  I have a table with bit
> mapped fields such that the long integer has bits "on" or 1 in specific
> circumstances.  Now I want to OR in other numbers in SQL.  I have a SQL
> statement that looks like:
>
> SELECT MsysForms.FRM_GroupOpen, ([MsysForms]![frm_GroupOpen] Or 1) AS
NewVal
> FROM MsysForms;
>
> regardless of the value contained in the field frm_GroupOpen, the NewVal
is
> always -1 for an OR or an AND of any other value, and 0 for an XOR.
>
> If I have a 4 in the field, 4 OR 1 should give me 5, but it is giving
me -1.
> I believe it is "interpreting" it and saying it is true.  But why?
>
> John W. Colby
> www.colbyconsulting.com
>
>
> _______________________________________________
> AccessD mailing list
> AccessD at databaseadvisors.com
> http://databaseadvisors.com/mailman/listinfo/accessd
> Website: http://www.databaseadvisors.com


--
Lexacorp Ltd
http://www.lexacorp.com.pg
Information Technology Consultancy, Software Development,System Support.



_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com





More information about the AccessD mailing list