Using Access 2003
On the Main Menu, one option in an Option Group is to "Get member attendance for the current Fiscal Year." The fiscal year is from October 1 through September 30.
When I click on the option in question, the code that runs is
As you can see, frmDateSelector is opened and 3 things happen:
1. The start date for the period is plugged into txtStartDate
2. The end date for the period is plugged into txtEndDate
3. The report is identified in [Text7] Select Case statements in code behind the form determine which report to run.
The user then clicks either a Preview command button or a Print command button. When the PREVIEW button is pressed, nothing happens. This is the code behind the Preview button
Curiously, pressing the PRINT button works fine. The code behind the Print button is
The SQL behind the query that populates the report is
But this same SQL runs irrespective of whether the PREVIEW or PRINT button is pressed.
Any clues as to what is going on here?
Thanks.
Tom
On the Main Menu, one option in an Option Group is to "Get member attendance for the current Fiscal Year." The fiscal year is from October 1 through September 30.
When I click on the option in question, the code that runs is
Code:
Case Is = 6
DoCmd.Close
DoCmd.OpenForm "frmDateSelector", acNormal
[Forms]![frmDateSelector]![Text7] = "MEMBERS ATTENDANCE TOTALS for CURRENT Fiscal Year"
[Forms]![frmDateSelector]![txtEndDate] = DateSerial(Year(Date), 9, 30)
[Forms]![frmDateSelector]![txtStartDate] = DateSerial(Year(Date) - 1, 10, 1)
1. The start date for the period is plugged into txtStartDate
2. The end date for the period is plugged into txtEndDate
3. The report is identified in [Text7] Select Case statements in code behind the form determine which report to run.
The user then clicks either a Preview command button or a Print command button. When the PREVIEW button is pressed, nothing happens. This is the code behind the Preview button
Code:
Case Is = "MEMBERS ATTENDANCE TOTALS for CURRENT Fiscal Year"
DoCmd.OpenReport "rptTotalAttendanceForPeriodSelected", acViewPreview, , "[FirstOfMeetingDate] Between Forms!frmDateSelector!txtStartDate AND Forms!frmDateSelector!txtEndDate"
Curiously, pressing the PRINT button works fine. The code behind the Print button is
Code:
Case Is = "MEMBERS ATTENDANCE TOTALS for CURRENT Fiscal Year"
DoCmd.OpenReport "rptTotalAttendanceForPeriodSelected", acViewNormal, , "[FirstOfMeetingDate] Between Forms!frmDateSelector!txtStartDate AND Forms!frmDateSelector!txtEndDate"
The SQL behind the query that populates the report is
Code:
SELECT qryAttendance.MemberID, qryAttendance.FullName, qryAttendance.TypeOfMeeting, Count(qryAttendance.MemberID) AS CountOfMemberID, First(qryAttendance.MeetingDate) AS FirstOfMeetingDate, IIf(Weekday(DateSerial(Year([MeetingDate]),12,25))=5 And Weekday(DateSerial(Year([MeetingDate]),1,1))=5,50,IIf(Weekday(DateSerial(Year([MeetingDate]),12,25))=5 Or Weekday(DateSerial(Year([MeetingDate]),1,1))=5,51,52)) AS WeekCount, RetThur([Forms]![frmDateSelector]![txtStartDate],[Forms]![frmDateSelector]![txtEndDate]) AS Thursdays, qryAttendance.LastName, qryAttendance.PreferredName
FROM qryAttendance
GROUP BY qryAttendance.MemberID, qryAttendance.FullName, qryAttendance.TypeOfMeeting, IIf(Weekday(DateSerial(Year([MeetingDate]),12,25))=5 And Weekday(DateSerial(Year([MeetingDate]),1,1))=5,50,IIf(Weekday(DateSerial(Year([MeetingDate]),12,25))=5 Or Weekday(DateSerial(Year([MeetingDate]),1,1))=5,51,52)), qryAttendance.LastName, qryAttendance.PreferredName
ORDER BY qryAttendance.TypeOfMeeting DESC;
Any clues as to what is going on here?
Thanks.
Tom