J
jkendrick75
I am using a form,frmDateRange, that has a start date, end date, and 2
checkboxes. using these checkboxes, depending upon which one is checked will
open up 1 of 3 different reports. one check box, chkToday, is set to open a
report that only uses today's date as a search value for the query that the
report uses. chkSums is used to determine whether to open a report that just
lists the data, or open a report that groups, lists, and sums the data. The
start and end date text boxes are used to enter the start and end dates for
the queries that these last 2 reports use
My problem is this:
when i close out of the database and then open it again, i use a switchboard
to open up the form frmDateRange. if i just hit the enter key, i can open
the report rptTodayReport like it should. if i click on the check box
chkToday, to remove the checkmark, i enter the start and end dates, then
press enter, the rptDateRangeReport does not open. if i check the chkSums
checkbox, and hit enter the report rptDateRangeSumsReport, the report opens
correctly. after doing this, if i uncheck the chkSums check box, and then
hit enter, the rptDateRangeReport opens correctly. why is this? i have
included all the code that deals with the form below (also i am using Access
2000, and the chkToday is set to have a default of checked, while chkSums
default is unchecked)
Option Compare Database
Private Sub chkToday_Click()
If chkToday = True Then
chkSums.Enabled = False
StartDate.Enabled = False
EndDate.Enabled = False
ElseIf chkToday <> True Then
chkSums.Enabled = True
StartDate.Enabled = True
EndDate.Enabled = True
End If
End Sub
Private Sub cmdExit_Click()
On Error GoTo Err_cmdExit_Click
DoCmd.Close
Exit_cmdExit_Click:
Exit Sub
Err_cmdExit_Click:
MsgBox Err.Description
Resume Exit_cmdExit_Click
End Sub
Private Sub cmdOpenReport_Click()
On Error GoTo Err_cmdOpenReport_Click
Dim stDocName As String
If chkToday = -1 Then
stDocName = "rptTodayReport"
DoCmd.OpenReport stDocName, acPreview
ElseIf chkToday <> -1 Then
If chkSums = 0 Then
stDocName = "rptDateRangeReport"
DoCmd.OpenReport stDocName, acPreview
ElseIf chkSums = -1 Then
stDocName = "rptDateRangeSumsReport"
DoCmd.OpenReport stDocName, acPreview
End If
End If
Exit_cmdOpenReport_Click:
Exit Sub
Err_cmdOpenReport_Click:
MsgBox Err.Description
Resume Exit_cmdOpenReport_Click
End Sub
Private Sub Form_Open(Cancel As Integer)
If chkToday = 1 Then
chkSums.Enabled = False
StartDate.Enabled = False
EndDate.Enabled = False
End If
End Sub
checkboxes. using these checkboxes, depending upon which one is checked will
open up 1 of 3 different reports. one check box, chkToday, is set to open a
report that only uses today's date as a search value for the query that the
report uses. chkSums is used to determine whether to open a report that just
lists the data, or open a report that groups, lists, and sums the data. The
start and end date text boxes are used to enter the start and end dates for
the queries that these last 2 reports use
My problem is this:
when i close out of the database and then open it again, i use a switchboard
to open up the form frmDateRange. if i just hit the enter key, i can open
the report rptTodayReport like it should. if i click on the check box
chkToday, to remove the checkmark, i enter the start and end dates, then
press enter, the rptDateRangeReport does not open. if i check the chkSums
checkbox, and hit enter the report rptDateRangeSumsReport, the report opens
correctly. after doing this, if i uncheck the chkSums check box, and then
hit enter, the rptDateRangeReport opens correctly. why is this? i have
included all the code that deals with the form below (also i am using Access
2000, and the chkToday is set to have a default of checked, while chkSums
default is unchecked)
Option Compare Database
Private Sub chkToday_Click()
If chkToday = True Then
chkSums.Enabled = False
StartDate.Enabled = False
EndDate.Enabled = False
ElseIf chkToday <> True Then
chkSums.Enabled = True
StartDate.Enabled = True
EndDate.Enabled = True
End If
End Sub
Private Sub cmdExit_Click()
On Error GoTo Err_cmdExit_Click
DoCmd.Close
Exit_cmdExit_Click:
Exit Sub
Err_cmdExit_Click:
MsgBox Err.Description
Resume Exit_cmdExit_Click
End Sub
Private Sub cmdOpenReport_Click()
On Error GoTo Err_cmdOpenReport_Click
Dim stDocName As String
If chkToday = -1 Then
stDocName = "rptTodayReport"
DoCmd.OpenReport stDocName, acPreview
ElseIf chkToday <> -1 Then
If chkSums = 0 Then
stDocName = "rptDateRangeReport"
DoCmd.OpenReport stDocName, acPreview
ElseIf chkSums = -1 Then
stDocName = "rptDateRangeSumsReport"
DoCmd.OpenReport stDocName, acPreview
End If
End If
Exit_cmdOpenReport_Click:
Exit Sub
Err_cmdOpenReport_Click:
MsgBox Err.Description
Resume Exit_cmdOpenReport_Click
End Sub
Private Sub Form_Open(Cancel As Integer)
If chkToday = 1 Then
chkSums.Enabled = False
StartDate.Enabled = False
EndDate.Enabled = False
End If
End Sub