On my main form I have a combo box that I use to select from a list of 35 different reports. Once the report and criteria is selected a simple click of a command button generates the report. The following is a sample of the code attached to the click event on the command button.
If Me.cbo_reportselect_customer = 1 Then
DoCmd.OpenQuery "qry_temp1_criteria_rpt1", acNormal, acEdit
DoCmd.OpenQuery "qry_create_temp1", acNormal, acEdit
DoCmd.OpenQuery "qry_temp1_update", acNormal, acEdit
Me.sfr_report_detail.Visible = True
Me.sfr_report_detail.Form!cmd_drilldown1.Enabled = True
ElseIf Me.cbo_reportselect_customer = 20 Then
DoCmd.OpenQuery "qry_temp1_criteria_rptx20", acNormal, acEdit
DoCmd.OpenQuery "qry_create_temp1", acNormal, acEdit
DoCmd.OpenQuery "qry_temp1_update", acNormal, acEdit
Me.sfr_report_detail.Visible = True
Me.sfr_report_detail.Form!cmd_drilldown1.Enabled = False
Else
End If
Forms![frm_report_main]![sfr_report_detail].Requery
Me.sfr_report_detail.SetFocus
End Sub
This all works great until I use the drilldown command button in the subform that brings out the detail for each topic. If I go to change the type of report after drilling down into a previous report the following lines from the original code don’t work.
Me.sfr_report_detail.Form!cmd_drilldown1.Enabled = True
Forms![frm_report_main]![sfr_report_detail].Requery
I added another command button to requery the subform and it works when I click it. Like I said as long as I don’t click the drilldown button in the subform everything works fine, but when I open the drilldown form then close it the report command button doesn’t work properly.
Any help would be appreciated.
If Me.cbo_reportselect_customer = 1 Then
DoCmd.OpenQuery "qry_temp1_criteria_rpt1", acNormal, acEdit
DoCmd.OpenQuery "qry_create_temp1", acNormal, acEdit
DoCmd.OpenQuery "qry_temp1_update", acNormal, acEdit
Me.sfr_report_detail.Visible = True
Me.sfr_report_detail.Form!cmd_drilldown1.Enabled = True
ElseIf Me.cbo_reportselect_customer = 20 Then
DoCmd.OpenQuery "qry_temp1_criteria_rptx20", acNormal, acEdit
DoCmd.OpenQuery "qry_create_temp1", acNormal, acEdit
DoCmd.OpenQuery "qry_temp1_update", acNormal, acEdit
Me.sfr_report_detail.Visible = True
Me.sfr_report_detail.Form!cmd_drilldown1.Enabled = False
Else
End If
Forms![frm_report_main]![sfr_report_detail].Requery
Me.sfr_report_detail.SetFocus
End Sub
This all works great until I use the drilldown command button in the subform that brings out the detail for each topic. If I go to change the type of report after drilling down into a previous report the following lines from the original code don’t work.
Me.sfr_report_detail.Form!cmd_drilldown1.Enabled = True
Forms![frm_report_main]![sfr_report_detail].Requery
I added another command button to requery the subform and it works when I click it. Like I said as long as I don’t click the drilldown button in the subform everything works fine, but when I open the drilldown form then close it the report command button doesn’t work properly.
Any help would be appreciated.