testing array contenents

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have an array contining holiday dates. I want to check the array to see if
the current date is in the array, (is it a holiday). Is there a command
where I can pass the date and array name to see if the array contains the
date? for example: If array(curDate, arrayname) = yes, then....
 
Cheswyck said:
I have an array contining holiday dates. I want to check the array to see if
the current date is in the array, (is it a holiday). Is there a command
where I can pass the date and array name to see if the array contains the
date? for example: If array(curDate, arrayname) = yes, then....


No, there isn't. You could code up such a function yourself
pretty easily.

Alternatively, a Collection (along with error handling) can
do that sort of thing.

OTOH, Access is a database system and tables are the
optimized approach to storing/searching a list. You could
even use a simple DLookup function to this:

If IsNull(DLookup("flddate", "Holidays", _
"flddate=#" & curdate & "#")) Then
'Not a hoilday
Else
'Yes, it's a holiday
End If
 
Back
Top