Contact US

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Check date against holiday list

Check date against holiday list

Check date against holiday list


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 of holidays is short, you could put them into some variable fields and simply compare your date to each variable and, if it matches, run a macro to increment the date. This would be a series of RUN commands.

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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close