?
Solved

DTPicker -  How to determine the day of the week?

Posted on 2004-09-03
5
Medium Priority
?
487 Views
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
Example:
If DTPicker.Value = today’s date  (Monday, August 30)
then
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.
0
Comment
Question by:JakeB52
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
5 Comments
 
LVL 6

Accepted Solution

by:
bkthompson2112 earned 500 total points
ID: 11972231
Hi JakeB52,

You can use the Weekday function.  Like this:

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

bkt
0
 
LVL 6

Expert Comment

by:bkthompson2112
ID: 11972238
0
 
LVL 22

Expert Comment

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

Darko
0
 

Author Comment

by:JakeB52
ID: 11972441
Thanks Everyone!

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

Expert Comment

by:bkthompson2112
ID: 11972546
Thanks for the 'A' : )
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

650 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