Open the Toolbox and select More Controls (button with hammer and
wrench). A
list of more controls appears. Select the Calendar Control. Draw the
calendar on your form just like you would a listbox. Open properties and
name the calendar MyCalendar. Delete the combobox and add a textbox named
MyMondayDate. Go to the code window and type in the following subroutine:
Private Sub MyCalendar_Click()
Me!MyMondayDate = Me!MyCalendar.Value
End Sub
When you click on a date on the calendar, the date will be entered in the
MyMondayDate textbox.
Note: You might want to add additional code to check thata Monday was
clicked on the calendar.
PC Datasheet
Providing Customers A Resource For Help With Access, Excel And Word
Applications
(e-mail address removed)
cager said:
Steve,
I haven't considered using a calendar control. Would you mind
expanding
on
that since I'm not sure what that entails?
Douglas: My [entrydt] field only contains date. No times are listed.
:
Yes, you could do that. Note, though, that if your date field actually
contains date and time (such as it will if you're using the Now()
function
to populate it), you'll need
between Forms!MyForm!MyMondayDate and
DateAdd("d",5,Forms!MyForm!MyMondayDate)
--
Doug Steele, Microsoft Access MVP
(no private e-mails, please)
or could i do this in in the criteria of the [entrydt] field of my
query
using one combo box:
between Forms!MyForm!MyMondayDate and
DateAdd("d",4,Forms!MyForm!MyMondayDate)
which would run the query for all entry dates between the monday
date
and
the Friday date of the same week?
Is this correct?
:
When you choose a Monday date, you can always get the Friday date
by
adding
4 to the Monday date. You can use this fact in your situation and
eliminate
the second combobox.
Assuming your form name is MyForm and the name of the first
combobox
is
MyMondayDate, put the following criteria in the MondayDate field of
your
masin query:
Forms!MyForm!MyMondayDate
and put the following criteria in the FridayDate field of your main
query:
DateAdd("d",4,Forms!MyForm!MyMondayDate)
PC Datasheet
Providing Customers A Resource For Help With Access, Excel And Word
Applications
(e-mail address removed)
I have a query that when run shows 2 fields. Week begin dates
(always
the
Monday date) and week end dates (always the Friday date).
I want to link one combo box to the week begin date and depending
on
which
Monday date I chose I want the 2nd combo box to automatically
pull
the
corresponding Friday date for that week.
I'm not too good with SQL so any help would be greatly
appreciated.
These 2 dates would then be referenced in my main query and that
query
would
run based on those 2 dates in the combo boxes on the form.
Thanks in advance for you help.