D
Douglas Hitchcock
I'm upgrading a 97 database to 2003. in 97 this code runs without problem
or hassle:
subrptName = "sub_rpt_Charts"
DoCmd.OpenReport subrptName, acViewDesign
x = 0
Set rptChart = Reports(subrptName)
For Each ctl In rptChart.Controls
ctlArray(x, 1) = ctl.Name
If ctl.ControlType = acBoundObjectFrame Then
ctlArray(x, 2) = True
Else
ctlArray(x, 2) = False
End If
x = x + 1
Next ctl
x = x - 1
For y = 0 To x
If ctlArray(y, 2) = True Then
DeleteReportControl rptChart.Name, ctlArray(y, 1)
End If
Next y
If chk_RunChart = True Then
chart1 = "RunChart"
If chk_Histogram = True Then
chart2 = "Histogram"
Else
chart2 = "StdDev"
End If
Else
chart1 = "Histogram"
chart2 = "StdDev"
End If
Set ctlReport = CreateReportControl(subrptName,
acBoundObjectFrame,
acDetail _, , , 0, 300, 4560, 2340)
ctlReport.ControlSource = chart1
ctlReport.SizeMode = acOLESizeStretch
Set ctlReport = CreateReportControl(subrptName,
acBoundObjectFrame,
acDetail _, , , 4620, 300, 4560, 2340)
ctlReport.ControlSource = chart2
ctlReport.SizeMode = acOLESizeStretch
If frme_Chart = 1 Then
rptChart.GroupLevel(0).ControlSource = "Product"
rptChart.GroupLevel(1).ControlSource = "Spec"
Else
rptChart.GroupLevel(1).ControlSource = "Product"
rptChart.GroupLevel(0).ControlSource = "Spec"
End If
Reports(subrptName).Filter = _
"([Product] " & strProd & ") AND ([Spec] " & strSpec & ")"
Reports(subrptName).FilterOn = True
DoCmd.SetWarnings False
DoCmd.Close acReport, subrptName, acSaveYes
DoCmd.SetWarnings True
Actually, the DoCmd.SetWarnings weren't even necessary in 97, but that
DoCmd.Close line at the end added two annoying popups in 2003.
SetWarnings False got rid of one of them, but I still get this prompt:
http://purplerhino.mailcan.com/saveas.png
what can I do to suppress that message? the code works fine if you just
click ok there, but I don't want to make a user do that.
or hassle:
subrptName = "sub_rpt_Charts"
DoCmd.OpenReport subrptName, acViewDesign
x = 0
Set rptChart = Reports(subrptName)
For Each ctl In rptChart.Controls
ctlArray(x, 1) = ctl.Name
If ctl.ControlType = acBoundObjectFrame Then
ctlArray(x, 2) = True
Else
ctlArray(x, 2) = False
End If
x = x + 1
Next ctl
x = x - 1
For y = 0 To x
If ctlArray(y, 2) = True Then
DeleteReportControl rptChart.Name, ctlArray(y, 1)
End If
Next y
If chk_RunChart = True Then
chart1 = "RunChart"
If chk_Histogram = True Then
chart2 = "Histogram"
Else
chart2 = "StdDev"
End If
Else
chart1 = "Histogram"
chart2 = "StdDev"
End If
Set ctlReport = CreateReportControl(subrptName,
acBoundObjectFrame,
acDetail _, , , 0, 300, 4560, 2340)
ctlReport.ControlSource = chart1
ctlReport.SizeMode = acOLESizeStretch
Set ctlReport = CreateReportControl(subrptName,
acBoundObjectFrame,
acDetail _, , , 4620, 300, 4560, 2340)
ctlReport.ControlSource = chart2
ctlReport.SizeMode = acOLESizeStretch
If frme_Chart = 1 Then
rptChart.GroupLevel(0).ControlSource = "Product"
rptChart.GroupLevel(1).ControlSource = "Spec"
Else
rptChart.GroupLevel(1).ControlSource = "Product"
rptChart.GroupLevel(0).ControlSource = "Spec"
End If
Reports(subrptName).Filter = _
"([Product] " & strProd & ") AND ([Spec] " & strSpec & ")"
Reports(subrptName).FilterOn = True
DoCmd.SetWarnings False
DoCmd.Close acReport, subrptName, acSaveYes
DoCmd.SetWarnings True
Actually, the DoCmd.SetWarnings weren't even necessary in 97, but that
DoCmd.Close line at the end added two annoying popups in 2003.
SetWarnings False got rid of one of them, but I still get this prompt:
http://purplerhino.mailcan.com/saveas.png
what can I do to suppress that message? the code works fine if you just
click ok there, but I don't want to make a user do that.