Re: Case Statement
- From: Robert Morley <rmorley@xxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Sat, 02 Feb 2008 14:33:00 -0500
Yes, True can be 1 for things like SQL Server and in some other languages, but by the time you've assigned them to boolean values in VB/VBA, they're necessarily going to have been converted to -1.
Rob
Marshall Barton wrote:
Robert Morley wrote:.
I like Rick's suggestion, though the conversion to string and then comparison of strings would probably slow it down significantly if it were in a very tight loop...probably not a problem unless it's something running hundreds of thousands of times, though.
Another common, albeit somewhat cryptic, method of doing it is as follows:
Select Case -blVal - 2 * buVal '- 4 * Next1 - 8 * Next2 - 16 * Next3, etc.
Case 0 'blVal = False, buVal = False
Case 1 'blVal = True, buVal = False
Case 2 'blVal = False, buVal = True
Case 3 'blVal = True, buVal = True
End Select
Exactly the approach I thought was too cryptic to be useful,
especially to someone that had to ask how :-)
I would also worry about the value of True being different
in various possible data sources.
- References:
- Re: Case Statement
- From: Robert Morley
- Re: Case Statement
- From: Marshall Barton
- Re: Case Statement
- Prev by Date: Re: Case Statement
- Next by Date: RE: How to obtain email server name associated with default mail c
- Previous by thread: Re: Case Statement
- Next by thread: Re: Case Statement
- Index(es):
Relevant Pages
|