Using Access 2003
An Option Group on the Main Menu feeds text information to a form called frmDateSelector on which there is a text box called "Text7" and a text box called "txtWeekCheck."
What is fed into Text7 is "Attendance for a SPECIFIC DATE report.". The user then plugs in a date in txtWeekCheck, and then presses either Preview or Print.
The code behind the Preview button is
What this code is supposed to do is check whether or not the WeekDay from the date entered in txtWeekCheck is Thursday.
What is happening is that if the WeekDay is a Thursday, the Preview and Print command buttons do not work (they just sit there and stare at me...and not that invitingly either).
Curiously, if the WeekDay of the date entered in txtWeekCheck is NOT a Thursday, everything works fine.
The other interesting thing is that all of this worked fine until I changed what is fed into Text7 from the Main Menu, and changed all of the code in frmDateSelector, from "Attendance for a GIVEN WEEK Report" to "Attendance for a SPECIFIC DATE Report"
I'm puzzled.
Tom
An Option Group on the Main Menu feeds text information to a form called frmDateSelector on which there is a text box called "Text7" and a text box called "txtWeekCheck."
What is fed into Text7 is "Attendance for a SPECIFIC DATE report.". The user then plugs in a date in txtWeekCheck, and then presses either Preview or Print.
The code behind the Preview button is
Code:
Private Sub cmdOpenReport_Click()
On Error GoTo Err_cmdOpenReport_Click
Dim stDocName As String
If IsNull(Me.txtStartDate) And Me.Text7 <> "Attendance for a SPECIFIC DATE Report" Then
MsgBox "Please enter a Start Date.", vbOKOnly, "Start Date missing"
Me.Undo
Me.txtStartDate.SetFocus
Exit Sub
ElseIf IsNull(Me.txtEndDate) And Me.Text7 <> "Attendance for a SPECIFIC DATE Report" Then
MsgBox "Please enter an End Date.", vbOKOnly, "End Date missing"
Me.txtEndDate.SetFocus
Exit Sub
ElseIf Me.txtEndDate < Me.txtStartDate And Me.Text7 <> "Attendance for a SPECIFIC DATE Report" Then
Call MsgBox("END Date must be greater than START Date!", vbExclamation, "Date check")
Me.txtStartDate = ""
Me.txtEndDate = ""
Me.txtStartDate.SetFocus
Exit Sub
End If
stDocName = Me.Text7
Select Case stDocName
Case Is = "Attendance for a SPECIFIC DATE Report"
If Weekday(Me.txtWeekCheck) <> 5 Then
Select Case MsgBox("The date you entered is not a Thursday!" _
& vbCrLf & "" _
& vbCrLf & " Do you still wish a report for that date?" _
, vbYesNo Or vbExclamation Or vbDefaultButton1, "Is Date entered a Thursday?")
Case vbYes
DoCmd.OpenReport "rptAttendanceWeekly", acViewPreview, , "[MeetingDate] = Forms!frmDateSelector!txtWeekcheck"
Select Case MsgBox("Do you wish to Preview the Guests for that date?", vbYesNo Or vbExclamation Or vbDefaultButton1, Application.Name)
Case vbYes
DoCmd.OpenReport "rptGuestWithName", acViewPreview, , "[GuestDate]=Forms!frmDateSelector!txtWeekCheck"
Case vbNo
Exit Sub
End Select
Case vbNo
Me.txtWeekCheck = Null
Me.txtWeekCheck.SetFocus
Exit Sub
End Select
End If
End Sub
What this code is supposed to do is check whether or not the WeekDay from the date entered in txtWeekCheck is Thursday.
What is happening is that if the WeekDay is a Thursday, the Preview and Print command buttons do not work (they just sit there and stare at me...and not that invitingly either).
Curiously, if the WeekDay of the date entered in txtWeekCheck is NOT a Thursday, everything works fine.
The other interesting thing is that all of this worked fine until I changed what is fed into Text7 from the Main Menu, and changed all of the code in frmDateSelector, from "Attendance for a GIVEN WEEK Report" to "Attendance for a SPECIFIC DATE Report"
I'm puzzled.
Tom