I have a form that collects parameters to be used in a report. In that form, the user has a choice to either enter in the parameters and then press the "OK" button or press the "Cancel" button and close both the report and the form. Right now everything work except for the fact the when the user selects the "cancel" button, they still get prompted to enter in the parameter values... Is there a way to supress the parameter input boxes that appear??? Here's my code...I added a little to prove to myself that the report isn't closing like it should....when I test to see if a report is open, it is -even after my Docmd.close ac report ran.
Private Sub Report_Open(Cancel As Integer)
Dim fcount As Integer 'used to count open forms
Dim rcound As Integer 'used to count open reports
On Error Resume Next
DoCmd.OpenForm "frmParameters", acNormal, , , acFormEdit, acDialog 'this suspends running of report until form is hidden or closed
'code pause here until a buttom is pushed...
fcount = IIf(Forms.Count = 0, 0, 1) 'counts how many forms are open and flags variable if at least one is open
If fcount = 0 Then 'runs if no forms are open, suppose to close the report if the parameter form is closed
DoCmd.Close acReport, "Report_2002GiftsAllDrops_CircPlan_SubReport(Buyers)" 'closes report again
End If
'problem is it still asks for parameters
rcount = IIf(Reports.Count = 0, 0, 1) 'returns 1, proves that the preceding statement doesn't close the report...??
End Sub
Any help would be greatly appreciated, thanks.
Andre
Private Sub Report_Open(Cancel As Integer)
Dim fcount As Integer 'used to count open forms
Dim rcound As Integer 'used to count open reports
On Error Resume Next
DoCmd.OpenForm "frmParameters", acNormal, , , acFormEdit, acDialog 'this suspends running of report until form is hidden or closed
'code pause here until a buttom is pushed...
fcount = IIf(Forms.Count = 0, 0, 1) 'counts how many forms are open and flags variable if at least one is open
If fcount = 0 Then 'runs if no forms are open, suppose to close the report if the parameter form is closed
DoCmd.Close acReport, "Report_2002GiftsAllDrops_CircPlan_SubReport(Buyers)" 'closes report again
End If
'problem is it still asks for parameters
rcount = IIf(Reports.Count = 0, 0, 1) 'returns 1, proves that the preceding statement doesn't close the report...??
End Sub
Any help would be greatly appreciated, thanks.
Andre