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

Access Date function

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
What is the function to list a date from today and 7 days ahead in a combo box? How would I go about that?

Any help is appreciated.
 
Copy and paste this code in your form's class module. (Forgive me if you already know this, but to get to that, just click the little window with the blue, yellow and red dashes around its edge in the toolbar.)
Code:
Private Sub Form_Load()
Me.Combo2.RowSourceType = "value list"
Me.Combo2.RowSource = Date & ";" & Date + 1 & ";" & Date + 2 & ";" & Date + 3 & ";" & Date + 4 & ";" & Date + 5 _
 & ";" & Date + 6 & ";" & Date + 7
End Sub
Of course, if you don't want a date to show, but a day, then you can format the date as in:
Code:
format(date,"dddd") & ";" & format(date+1,"dddd")
which will show
Tuesday
Wednesday...etc in your combo box
instead of
2/6/01
2/7/01...etc
The possibilities are endless. Best of success s-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top