473,397 Members | 1,949 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

Syntax For Using A Variable To Evaluate Multiple "Or" Conditions

In the code below, it seems like there should be a way to simplify the
expression to search for the specific values of 1, 9, 10, 11 and 12.
It would be more tedious if I was looking to execute some code when x
would evaluate to, say, 1 or 3 or 5 or 7 and so on. Could someone
provide a suggestion?
.........
Dim x As Boolean
x = (Val(Left(Format(Date, "mm/dd/yyyy"), 2)) >= 9) Or
(Val(Left(Format(Date, "mm/dd/yyyy"), 2)) < 2)
..........
Thanks,
Sheldon Potolsky

Dec 14 '06 #1
2 1686

"Sheldon" <SH********@aol.comwrote in message
news:11**********************@l12g2000cwl.googlegr oups.com...
In the code below, it seems like there should be a way to simplify the
expression to search for the specific values of 1, 9, 10, 11 and 12.
It would be more tedious if I was looking to execute some code when x
would evaluate to, say, 1 or 3 or 5 or 7 and so on. Could someone
provide a suggestion?
........
Dim x As Boolean
x = (Val(Left(Format(Date, "mm/dd/yyyy"), 2)) >= 9) Or
(Val(Left(Format(Date, "mm/dd/yyyy"), 2)) < 2)
This should work, if you like it any better:

Select Case Val(Left(Format(Date, "mm/dd/yyyy"), 2)
Case 1, 9, 11, 12
... do something
Case Else
... do something else
End Select

Larry Linson
Microsoft Access MVP
Dec 14 '06 #2
Sheldon wrote:
>In the code below, it seems like there should be a way to simplify the
expression to search for the specific values of 1, 9, 10, 11 and 12.
It would be more tedious if I was looking to execute some code when x
would evaluate to, say, 1 or 3 or 5 or 7 and so on. Could someone
provide a suggestion?
........
Dim x As Boolean
x = (Val(Left(Format(Date, "mm/dd/yyyy"), 2)) >= 9) Or
(Val(Left(Format(Date, "mm/dd/yyyy"), 2)) < 2)

Select Case Month(Date)
Case 1, 9 To 12
. . .
Case Else
. . .
End Select

--
Marsh
Dec 14 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Sara Khalatbari | last post by:
Hi! Suppose you're writing a module & writing the definition of each function in that module in " or """. for example: a) "This function does this & that" or: b) """This function does blah...
40
by: Steve Juranich | last post by:
I know that this topic has the potential for blowing up in my face, but I can't help asking. I've been using Python since 1.5.1, so I'm not what you'd call a "n00b". I dutifully evangelize on the...
134
by: James A. Donald | last post by:
I am contemplating getting into Python, which is used by engineers I admire - google and Bram Cohen, but was horrified to read "no variable or argument declarations are necessary." Surely that...
3
by: Colleyville Alan | last post by:
I am constructing a SQL command from a function. Some code builds the WHERE clause in a looping structure and passes that as an argument to the SQL-building function. But the results do not...
12
by: junky_fellow | last post by:
Which is better using a switch statement or the if-then equivalent of switch ?
0
by: Ben | last post by:
I want to say: SELECT tableA.stuff,tableB.morestuff,tableC.stillmorestuff FROM tableA, LEFT OUTER JOIN tableB ON (AB match conditions) LEFT OUTER JOIN tableC ON (AC match conditions) WHERE etc...
3
by: Ben | last post by:
I want to say: SELECT tableA.stuff,tableB.morestuff,tableC.stillmorestuff FROM tableA, LEFT OUTER JOIN tableB ON (AB match conditions) LEFT OUTER JOIN tableC ON (AC match conditions) WHERE etc...
5
by: comp.lang.php | last post by:
$orderBy = 's.app_date desc, s.last_name asc, s.first_name asc, s.mi asc'; if ($_REQUEST) { $ascArray = array('asc' => 'desc', 'desc' => 'asc'); // ARRAY OF ALL ORDERING POSSIBILITIES $junk =...
9
by: axs221 | last post by:
I am trying to move some of our large VBA Access front-end file into ActiveX DLL files. I created two DLL files so far, one was a module that contains code to integrate into the QuickBooks...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.