Solved

Access/Excel VBA - is a date on a weekend

Posted on 2011-03-16
4
637 Views
Last Modified: 2012-05-11
Hi

In Access or Excel VBA what code would I use to fdetermine if a date lies on a weekend.
Thanks
0
Comment
Question by:murbro
  • 2
4 Comments
 
LVL 22

Accepted Solution

by:
Kelvin Sparks earned 250 total points
ID: 35145870
If Weekday(Yourdate) = 1 or weekday(yourdate) = 7 then
    'You have a weekdend day

End if
0
 
LVL 22

Expert Comment

by:Kelvin Sparks
ID: 35145871
This is for Access
0
 
LVL 49

Assisted Solution

by:Gustav Brock
Gustav Brock earned 250 total points
ID: 35145991
It can be done with one call only of Weekday:

booDateIsWeekend = Weekday(datSomeDate, vbMonday) >= 6

/gustav
0
 

Author Closing Comment

by:murbro
ID: 35146201
thank you both
0

Featured Post

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
Familiarize people with the process of utilizing SQL Server stored procedures from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Micr…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question