Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Checking Date to See if it is a Monday

Status
Not open for further replies.

jt463

IS-IT--Management
Nov 23, 2005
134
I have read the thread on identifying dates whether or not they are a business day. However, I want to know if there is any functionality in VBA that will allow my code to check the date a user enters and validate that it is a Monday and only let the code continue if it is.

I have an ActiveX Calendar that allows users to select a date. Logically, they should be able to pick the Monday on the calendar. However, I would like to provide a contingency just in case they fat finger a date or forget to use the control.

Since I am a novice user, I was not able to understand the code for the business days well enough to see if that concept would answer my question.

Thanks in advance.
 
jt463,
[tt]If Weekday([YourDate], vbSunbday) = 2 Then[/tt]
or
[tt]If YourDate Mod 7 = 2 Then[/tt]

Hope this helps,
CMP

[small]For the best results do what I'm thinking, not what I'm saying.[/small]
(GMT-07:00) Mountain Time (US & Canada)
 
I never knew about the weekday function.. i've always used format

Format(date, "dddd")

will return what day of the week it is in a "monday" format

Randall Vollen
National City Bank Corp.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top