北京 | 上海 | 天津 | 重庆 | 广州 | 深圳 | 珠海 | 汕头 | 佛山 | 中山 | 东莞 | 南京 | 苏州 | 无锡 | 常州 | 南通 | 扬州 | 徐州 | 杭州 | 温州 | 宁波 | 台州 | 福州 | 厦门 | 泉州 | 龙岩 | 合肥 | 芜湖 | 成都 | 遂宁 | 长沙 | 株洲 | 湘潭 | 武汉 | 南昌 | 济南 | 青岛 | 烟台 | 潍坊 | 淄博 | 济宁 | 太原 | 郑州 | 石家庄 | 保定 | 唐山 | 西安 | 大连 | 沈阳 | 长春 | 昆明 | 兰州 | 哈尔滨 | 佳木斯 | 南宁 | 桂林 | 海口 | 贵阳 | 西宁 | 乌鲁木齐 | 包头 |
Function ReportFormat(rpt As Report, ctlID As Control, Optional FormatMode As Integer = 0, _
Optional FillBlankLine As Boolean = True) As Boolean
On Error GoTo Err_ReportFormat
Dim intMaxRec As Integer
Static intMaxRecOfPage1 As Integer
Dim intRecCount As Integer
Dim intCtlCount As Integer
Dim intMaxctl As Integer
Dim sngTop As Single
Dim strFirst As String
Dim strLast As String
Dim ctlFirst As Control
Dim ctlLast As Control
With rpt.Section(acDetail)
If rpt.Page = 1 Then
intMaxRecOfPage1 = ctlID.Value
intMaxRec = intMaxRecOfPage1 - 1
Else
If FillBlankLine = True Then
intMaxRec = intMaxRecOfPage1 - 1
Else
intMaxRec = ctlID.Value - intMaxRecOfPage1 * (rpt.Page - 1) - 1
End If
End If
For intRecCount = 0 To intMaxRec
sngTop = ctlID.Top + .Height * intRecCount + rpt.Section(acPageHeader).Height
intMaxctl = .Controls.Count - 1
For intCtlCount = 0 To intMaxctl
With rpt.Section(acDetail).Controls(intCtlCount)
If intCtlCount = 0 Then strFirst = .Name
If .Visible = True Or .Name = ctlID.Name Then
If FormatMode <> 1 Then rpt.Line (.Left, sngTop)- _
(.Left, sngTop + rpt.Section(acDetail).Height)
End If
If intCtlCount = intMaxctl Then
strLast = .Name
If FormatMode <> 1 Then rpt.Line (.Left + .Width, sngTop)- _
(.Left + .Width, sngTop + rpt.Section(acDetail).Height)
End If
End With
Next
Set ctlFirst = .Controls(strFirst)
Set ctlLast = .Controls(strLast)
If FormatMode <> 2 Then
rpt.Line (ctlFirst.Left, sngTop)-(ctlLast.Left + ctlLast.Width, sngTop)
If intRecCount = intMaxRec Then
rpt.Line (ctlFirst.Left, sngTop + .Height)- _
(ctlLast.Left + ctlLast.Width, sngTop + .Height)
End If
End If
Next
End With
If Err.Number = 0 Then ReportFormat = True
Exit_ReportFormat:
Exit Function
Err_ReportFormat:
ReportFormat = False
MsgBox "Error Number" & Chr(13) & Err.Number & Chr(13) & Err.Description, vbCritical
Resume Exit_ReportFormat
End Function