a我考网

 找回密码
 立即注册

QQ登录

只需一步,快速开始

扫一扫,访问微社区

查看: 62|回复: 0

[Visual Basic] 计算机二级考试Access辅导:页面设置模块代码分享

[复制链接]
发表于 2012-7-31 22:10:12 | 显示全部楼层 |阅读模式
  Dim up, dn, le, ri, si, liAs Single , co As string’定义边距及页面函数
. q( J1 ?- _* l, L* t) O7 ~/ \* Z  Sub ymszmk(strName As String) ’页面设置模块On Error GoTo Err_ymszmkIf Nz(DCount("*", "REPORTLIP", "REPORT=’" & strName & "’")) = 0 ThenMsgBox "没有此报表的页面设置,请设置", , "提示"Exit SubEnd Ifup = DLookup("REUP", "REPORTLIP", "REPORT=’" & strName & "’")dn = DLookup("REDOWN", "REPORTLIP", "REPORT=’" & strName & "’")le = DLookup("RELEFT", "REPORTLIP", "REPORT=’" & strName & "’")ri = DLookup("RERIGHT", "REPORTLIP", "REPORT=’" & strName & "’")li = DLookup("RECOL", "REPORTLIP", "REPORT=’" & strName & "’")si = DLookup("RESIZE", "REPORTLIP", "REPORT=’" & strName & "’")co = IIf(DLookup("RECOURES", "REPORTLIP", "REPORT=’" & strName & "’") Like "横向", acPRORLandscape, acPRORPortrait)Dim prt As Printer
' q1 ^8 Y: F  ^" a7 f- h% P  Set prt = Application.Printers(0), A9 {+ p& n: |; p7 Y! J% `0 w
  prt.TopMargin = up * 56.7 ’上prt.BottomMargin = dn * 56.7 ’下prt.LeftMargin = le * 56.7 ’左prt.RightMargin = ri * 56.7 ’右prt.ItemsAcross = li ’列prt.PaperSize = si ’大小prt.Orientation = co
) t! y* b$ \$ @0 l% @  DoCmd.OpenReport strName, acPreviewReports(strName).Printer = prt; m9 ]$ k4 Y$ ^9 I2 g5 t/ i8 V& p$ F
  Exit_Err_ymszmk: Exit Sub0 g5 C$ R" k5 b% G) `
  Err_ymszmk: If Err = 5 Then MsgBox "没有打印机,请先安装打印机!", , "提示" Exit Sub End If MsgBox Err.Description Resume Exit_Err_ymszmkEnd Sub
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|Woexam.Com ( 湘ICP备18023104号 )

GMT+8, 2024-6-2 15:13 , Processed in 0.570451 second(s), 21 queries .

Powered by Discuz! X3.4 Licensed

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表