Well, we're getting further!
I deleted the 2 click events for the two calendar controls in my form.
I added the sql string to my query which now looks like this:
SELECT [ADMIN CASES].DHSNo, [ADMIN CASES].CaseName, [ADMIN CASES].Region,
[ADMIN CASES].AssignDate, [ADMIN CASES].DHSAttny, STATUS.ClosedDate, [ADMIN
CASES].Program, [ADMIN CASES].Asstnt
FROM [ADMIN CASES] INNER JOIN STATUS ON [ADMIN CASES].DHSNo = STATUS.DHSNo
WHERE ((([ADMIN CASES].AssignDate) Between
[Forms]![frmCaldendar]![Calendar1].[Value] And
[Forms]![frmCalendar]![Calendar2].[value]));
I added a button to my frmCaldendar that runs a macro that opens the report.
The report is generated from the query above. However, I get this popup:
Enter Parameter Value
Forms!frmCaldendar!Calendar1.Value
So, now what???
Why isn't the query reading the value of Calendar1?
S. Jackson
That was my point in my previous reply since I wasn't where StartDate and
EndEnd come from.
Forget about the 2 Calendar_Click Event since you can use the values from
the Calendars directly.
The SQL String of your Query should be something like:
SELECT [ADMIN CASES].DHSNo, [ADMIN CASES].CaseName, [ADMIN CASES].Region,
[ADMIN CASES].AssignDate,
[ADMIN CASES].DHSAttny, STATUS.ClosedDate
FROM [ADMIN CASES] INNER JOIN STATUS
ON [ADMIN CASES].DHSNo = STATUS.DHSNo;
WHERE [ADMIN CASES].AssignDate
BETWEEN Forms!YourFormName!Calendar1.Value
AND Forms!YourFormName!Calendar2.Value
Substitute the name of the Form and Calendars as appropriate.
--
HTH
Van T. Dinh
MVP (Access)
Shelly Jackson said:
Here is exactly what I've done:
I built a form that has not data source. Its purpose is to ask the
user
for
a start date and end date and then print a report. I inserted two calendar
controls named Calendar1 and Calendar2. I want the user to select a
Startdate from Calendar1 and an
EndDate from Calendar2.
I clicked view Code:
I changed the event to OnClick and put in the following code:
Private Sub Calendar1_Click()
StartDate = Calendar1.Value
End Sub
And for Calendar2:
Private Sub Calendar2_Click()
EndDate = Calendar2.Value
End Sub
I also insert a button on the form that will run a macro that opens my
report.
Now I am trying to build a query for the report that collects data
from
the
Startdate selected by the user on Caldendar1 up to and including the EndDate
selected on Caldendar2.
The SQL View of my query looks like this:
SELECT [ADMIN CASES].DHSNo, [ADMIN CASES].CaseName, [ADMIN CASES].Region,
[ADMIN CASES].AssignDate, [ADMIN CASES].DHSAttny, STATUS.ClosedDate, [ADMIN
CASES].Program, [ADMIN CASES].Asstnt
FROM [ADMIN CASES] INNER JOIN STATUS ON [ADMIN CASES].DHSNo = STATUS.DHSNo
I'm lost. Please help! I don't know how to write the WHERE portion
of
the