|
8金钱
我使用了代码来动态设置报表的纸张及边距,但出现一个奇怪现象
打开报表时, 代码是执行了,但没有任何效果,可是手工打开页面设置, 发现里面的设置内容的确按代码已经修改了,如果这时按一下确定, 报表纸张设置才有效果
在Open事件中加了如下代码:
Dim rs As Recordset
Set rs = CodeDb.OpenRecordset("Select * From tblrptPageSize ", dbOpenDynaset)
With Me.Printer
.PaperSize = Nz(rs!rptPageSize, 9)
.TopMargin = Round(Nz(rs!rptTop, 0) * 56.7, 2)
.BottomMargin = Round(Nz(rs!rptBottom, 0) * 56.7, 2)
.LeftMargin = Round(Nz(rs!rptLeft, 0) * 56.7, 2)
.RightMargin = Round(Nz(rs!rptRight, 0) * 56.7, 2)
.Orientation = 2
.Copies = 1
End With |
最佳答案
查看完整内容
应该可以,需要用集合的方式打开报表才能改变纸张大小
Public clnClient As New Collection
Public Sub GetPage(ReportName As String) '读取页边距
Dim Rs As New ADODB.Recordset
Dim Conn As New ADODB.Connection
Set Conn = CurrentProject.Connection
Dim SQL As String
Dim Rpt As Report
SQL = "SELECT * FROM Dybbcs where bbmc='" & ReportName & "'"
Set Rpt = New Report_Test
Rs.Open SQL, Conn, a ...
|