Check date against holiday list
Check date against holiday list
(OP)
Hiya,
I have a macro that needs to check a date field (today's date) is not a public holiday (these are contain in a list in a file). If's it a public holiday then to increment start date to startdate+1 and skip rest of process.
How best to approach this?
Thanks in advance.
I have a macro that needs to check a date field (today's date) is not a public holiday (these are contain in a list in a file). If's it a public holiday then to increment start date to startdate+1 and skip rest of process.
How best to approach this?
Thanks in advance.
RE: Check date against holiday list
If the list is long, then you will want to use a different method. Save the identity of your current record and the date in question in variable fields. Then switch to a worksheet view of the holiday database and run a looping macro comparing the stored date to each holiday date. Note that a looping macro using Records Next will stop when it runs out of records in the current database. In the loop, if the date matches you RUN the increment macro and exit the loop. Or you run to the end and exit the loop. You would then use the variables saved to return to the form you were one originally (stored FIND) and do whatever you need to do with the variable date field.
Finally, you could write a script to take the date in question and do a SQL query against your holiday database. If no records are found you are "done" pretty quick without any loops or other problems. That script is not something I can provide here but you should be able to find examples if you search for "Resultset" on the Internet.
Sue Sloan