|
最近使用Access2003,想调用数据库中的数据生成一个report,发现一个比较奇怪的问题,向大家请教
我首先创建了一个form一个report, frm确认键的响应代码很简单是这样的:
Dim rpt As Report, ctlNew As Control
Dim tctl As Control
'''这部分是清空report中上次生成的已有的一些控件,但不清空footer中的pagename
DoCmd.OpenReport "rptA3", acViewDesign
Set rpt = Reports![rptA3]
errordel:
For Each tctl In rpt.Controls
If tctl.Name = "pagename" Then
GoTo a1
End If
DeleteReportControl rpt.Name, tctl.Name
a1: Next tctl
If rpt.Controls.count > 1 Then GoTo errordel
rpt.BorderStyle = 1
rpt.Section(acDetail).Height = 15
'''下面就是创建要在该report上显示的label
Set ctlNew = CreateReportControl(rpt.Name, acLabel, acDetail, , , 2700, 100, 5000, 600)
ctlNew.Caption = "你好"
ctlNew.FontBold = True
ctlNew.FontName = "黑体"
ctlNew.FontSize = 24
ctlNew.TextAlign = 2
ctlNew.SizeToFit
Set ctlNew = Nothing
Set ctlNew = CreateReportControl(rpt.Name, acLabel, acDetail, , , 500, 800, 800, 300)
ctlNew.Caption = "周期:"
ctlNew.FontBold = True
ctlNew.FontName = "黑体"
ctlNew.FontSize = 10
ctlNew.SizeToFit
Set ctlNew = Nothing
Set ctlNew = CreateReportControl(rpt.Name, acLabel, acDetail, , , 1500, 800, 1500, 300)
ctlNew.Caption = DLookup("codename", "tblcode", "codetype='Cycle' and codeNo='" & Me.ComrentDate.value & "'")
ctlNew.FontName = "黑体"
ctlNew.FontSize = 10
ctlNew.SizeToFit
Set ctlNew = Nothing
'''然后保存,并打开report
DoCmd.Save acReport, rpt.Name
DoCmd.OpenReport rpt.Name, acViewPreview
DoCmd.Maximize
在实际操作过程中,我打开form点击确认,报表便生成并最大化,但是我关闭报表再点击确认,如此反复多次后,就会出现报表打不开的问题
此时我在编辑界面双击rptA3,也打不开了,提示The expression on format you entered as the event property setting produced the following error:There isn't enough memory to complete the automation object on the | object.
在开发界面编译时,弹出窗口提示out of memory |
|