比如我想打印满了一个A4纸就换页,或者数据库读到三十条记录就换页,怎么写?
Private Sub Command1_Click()
Dim a As Integer
a = Text1.Text
For i = 1 To a
Printer.FontSize = 14
Printer.CurrentX = 6
Printer.CurrentY = 100
Printer.Print Tab(38); "排班表"
Printer.FontSize = 12
Printer.Print " ┌────┬───┬───┬─────────┬────┬──────┬───────────┐"
Printer.Print " │ 车牌 │公里 │ 油费 │ 地址 │司机编号│ 姓名 │ 日期时间 │"
Adodc4.Refresh
Do While Not Adodc4.Recordset.EOF
Printer.Print " ├────┼───┼───┼─────────┼────┼──────┼───────────┤"
Printer.Print Tab(2); "│"; Adodc4.Recordset.Fields("车牌"); Tab(12); "│"; Adodc4.Recordset.Fields("公里"); Tab(20); "│"; Adodc4.Recordset.Fields("油费"); Tab(28); "│"; Adodc4.Recordset.Fields("地址"); Tab(48); "│"; Adodc4.Recordset.Fields("司机编号"); Tab(58); "│"; Adodc4.Recordset.Fields("姓名"); Tab(72); "│"; Adodc4.Recordset.Fields("日期"); Tab(96); "│"; ""
Adodc4.Recordset.MoveNext
Loop
Printer.Print " └────┴───┴───┴─────────┴────┴──────┴───────────┘"
Adodc4.Refresh
Printer.EndDoc
Printer.KillDoc
Next iEnd Sub
Private Sub Command1_Click()
Dim a As Integer
a = Text1.Text
For i = 1 To a
Printer.FontSize = 14
Printer.CurrentX = 6
Printer.CurrentY = 100
Printer.Print Tab(38); "排班表"
Printer.FontSize = 12
Printer.Print " ┌────┬───┬───┬─────────┬────┬──────┬───────────┐"
Printer.Print " │ 车牌 │公里 │ 油费 │ 地址 │司机编号│ 姓名 │ 日期时间 │"
Adodc4.Refresh
Do While Not Adodc4.Recordset.EOF
Printer.Print " ├────┼───┼───┼─────────┼────┼──────┼───────────┤"
Printer.Print Tab(2); "│"; Adodc4.Recordset.Fields("车牌"); Tab(12); "│"; Adodc4.Recordset.Fields("公里"); Tab(20); "│"; Adodc4.Recordset.Fields("油费"); Tab(28); "│"; Adodc4.Recordset.Fields("地址"); Tab(48); "│"; Adodc4.Recordset.Fields("司机编号"); Tab(58); "│"; Adodc4.Recordset.Fields("姓名"); Tab(72); "│"; Adodc4.Recordset.Fields("日期"); Tab(96); "│"; ""
Adodc4.Recordset.MoveNext
Loop
Printer.Print " └────┴───┴───┴─────────┴────┴──────┴───────────┘"
Adodc4.Refresh
Printer.EndDoc
Printer.KillDoc
Next iEnd Sub
解决方案 »
- VB and SQLserver做系统 判定用户权限问题 求达人帮忙
- vb中如何用代码往图片框里添加图片
- 急求输出列的焦点保存问题
- 晕了,大家来看看,关于用集合保存记录集中的数据!
- 关于msgbox 急
- 请问在程序中怎样使用数据库中的关系?最好能给示例。谢谢了。
- 从datareport报表中导向HTML中后,出现了格式不对齐,怎么解决呀?
- 一个十分容易的问题,什么是水晶报表?
- 请问怎么编程实现24bit BMP file转化为256色 灰度
- 急急急!!!!!!!那位大哥青帮下忙,我现在帮别人做一个MID系统,里面要做数据......
- 请教这个事件过程中,进度条代码要插在哪处才正确?
- 在指定picturebox中创建控件的问题
Do While Not Adodc4.Recordset.EOF
If i > 29 Then
Printer.Print " ┌────┬───┬───┬─────────┬────┬──────┬───────────┐"
Printer.Print " │ 车牌 │公里 │ 油费 │ 地址 │司机编号│ 姓名 │ 日期时间 │"
Printer.NewPage
i = 0
End If
Printer.Print " ├────┼───┼───┼─────────┼────┼──────┼───────────┤"
Printer.Print Tab(2); "│"; Adodc4.Recordset.Fields("车牌"); Tab(12); "│"; Adodc4.Recordset.Fields("公里"); Tab(20); "│"; Adodc4.Recordset.Fields("油费"); Tab(28); "│"; Adodc4.Recordset.Fields("地址"); Tab(48); "│"; Adodc4.Recordset.Fields("司机编号"); Tab(58); "│"; Adodc4.Recordset.Fields("姓名"); Tab(72); "│"; Adodc4.Recordset.Fields("日期"); Tab(96); "│"; ""
Adodc4.Recordset.MoveNext
i = i + 1
Loop