|
本帖最后由 咱家是猫 于 2011-8-11 16:41 编辑
记得这是我在Access擂台区发起的一个竞赛,记得事后一直未分享MDB,现在发上来共享之.
- Option Compare Database
- Option Explicit
- Private LngA As Long, LngB As Long
- Private lngRows As Long
- 'BStr常量字符串为此报表右则需要标注的信息,此字符串长度需参照固定行数
- Private Const BStr = "白联:财务 红联:客户 黄联:留底"
- Private myASum As Double '本页合计
- Private myBSum As Double '总计
- Private Sub 页面页眉_Print(Cancel As Integer, PrintCount As Integer)
- LngB = 0: myASum = 0
- If Me.Pages <> 1 Then
- Me.出库单 = Me.出库单号 & "-" & Me.Page
- Else
- Me.出库单 = Me.出库单号
- End If
- End Sub
- Private Sub 主体_Print(Cancel As Integer, PrintCount As Integer)
- Dim intAllRows As Integer
- Dim objCtl As Control
- LngA = LngA + 1: LngB = LngB + 1
- Me.BLabel.Caption = GetBL(LngB)
- lngRows = 20
- If intAllRows = 0 Then
- If txtTotGrp Mod lngRows = 0 Then
- intAllRows = txtTotGrp
- Else
- intAllRows = (Fix(txtTotGrp / lngRows) + 1) * lngRows
- End If
- End If
- If LngA <= txtTotGrp Then
- For Each objCtl In Me.Section(0).Controls
- If objCtl.ControlType = acTextBox Then
- With objCtl
- .Visible = True
- End With
- End If
- Next objCtl
- myASum = myASum + Me.金额 '累计金额(本页小计)
- myBSum = myBSum + Me.金额 '累计金额(总计)
- Else
- If LngA = intAllRows + 1 Then LngA = 1
- For Each objCtl In Me.Section(0).Controls
- If objCtl.ControlType = acTextBox Then
- With objCtl
- .Visible = False
- End With
- End If
- Next objCtl
- End If
- If txtTotGrp < intAllRows Then
- If LngA < txtTotGrp Then
- Me.NextRecord = True
- ElseIf (LngA >= txtTotGrp And LngA < intAllRows) Then
- Me.NextRecord = False
- Else
- Me.NextRecord = True
- End If
- Else
- Me.NextRecord = True
- End If
- End Sub
- Private Sub 页面页脚_Format(Cancel As Integer, FormatCount As Integer)
- Me.总计标签.Visible = (Me.Page = Me.MyPages)
- Me.大写总计.Visible = (Me.Page = Me.MyPages)
- Me.小写总计.Visible = (Me.Page = Me.MyPages)
- Me.MyPageTipText.Visible = (Me.Page < Me.MyPages)
- Me.小写小计 = "¥" & myASum
- Me.大写小计 = "(大写)" & UCaseCur(myASum, 1)
- If Me.Page = Me.MyPages Then
- Me.小写总计 = "¥" & myBSum
- Me.大写总计 = "(大写)" & UCaseCur(myBSum, 1)
- End If
- End Sub
- Function GetBL(I As Long) As String
- GetBL = Mid(BStr, I, 1)
- End Function
复制代码
|
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有帐号?注册
x
|