DTPicker -  How to determine the day of the week?

Posted on 2004-09-03
Last Modified: 2013-12-25
Hi Experts

I’m generating a weekly report every Monday (usually, except when a holiday lands on the Monday). The From/To dates would range from the Monday to Sunday of the previous week.

In our old system, the user would have to enter the From/To dates each time the report was generated. I would like to have these dates pre-populated in my Access form using Microsoft’s Date Time Picker (DTPicker).

The logic would be if today is Monday (August 30) then
From Date =  2004-08-23  
To Date = 2004-08-29

The same would apply if the report was generated on Tuesday (August 31) which would be the case if Monday was a holiday. The results would be the same.
From Date =  2004-08-23  
To Date = 2004-08-29

I know that I can subtract days from the DTPicker value
If DTPicker.Value = today’s date  (Monday, August 30)
DTPicker1. Value = DTPicker1.value – 7
If today was Tuesday I would subtract 8 from the value, etc. to get the FROM date

The problem I’m having is that I can’t identify if today is a Monday, Tuesday, etc…

Any thoughts would be appreciated.
Question by:JakeB52
  • 3

Accepted Solution

bkthompson2112 earned 125 total points
ID: 11972231
Hi JakeB52,

You can use the Weekday function.  Like this:

Select Case Weekday(Now)
  Case vbSunday
  Case vbMonday
End Select


Expert Comment

ID: 11972238
LVL 22

Expert Comment

ID: 11972251
Try this:
MsgBox Format$(DtPicker1.Value, "dddd")


Author Comment

ID: 11972441
Thanks Everyone!

All your answers were helpful but bkthompson2112 was first off the block.

Expert Comment

ID: 11972546
Thanks for the 'A' : )

Featured Post

Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Excel Vlookup to move data back to source. 4 94
Problem to skip loop 6 58
VBA error replacing data 6 40
MS SQL store procedure to calculate and return result 6 58
There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

825 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