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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What days is this looking at 2

Status
Not open for further replies.

Cpreston

MIS
Mar 4, 2015
969
0
16
GB
Hi

We have some code in one of databases. I am not up on Access/VBA. Could someone explain what days this is looking at. It did not work over the weekend so I am wondering if this was the issue. Thanks

DOW = Weekday(Now())
If DOW >= 2 And DOW <= 6 Then
 
By default, Weekday functions starts with Sunday (1) through Saturday (7). So your function is checking for Monday to Friday inclusive.

So, yes, it is the issue.
 
Hi

Thought as much which is probably why it was not working over the weekend, I guess changing the line so it reads as below should cover all the days. Thanks

If DOW >= 1 And DOW <= 7 Then
 
Hi

No but the programming looks like it does other things so rather than upset anything it I thought that would be the easiest way to cover the whole week. Thanks
 
If you want to leave this code, that's fine. But I would add some comments like:[pre][green]'It used to check for work days only
'Changed to cover all days of the week[/green][/pre]
In a few months, or when somebody else takes over this app, it will be very confusing to see it without the reason for this line of code. It is like saying: If the month is between January and December then... Are there other months in a year....?

Just my opinion...


---- Andy

There is a great need for a sarcasm font.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top