📄 frmqs.frm
字号:
VERSION 5.00
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form frmqs
BorderStyle = 3 'Fixed Dialog
Caption = "确认起始行"
ClientHeight = 2085
ClientLeft = 45
ClientTop = 330
ClientWidth = 4935
Icon = "frmqs.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2085
ScaleWidth = 4935
ShowInTaskbar = 0 'False
StartUpPosition = 1 '所有者中心
Begin VB.Data Data1
Caption = "负责登记记录行号"
Connect = "Access"
DatabaseName = "data.mdb"
DefaultCursorType= 0 '缺省游标
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 345
Left = 240
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = "台帐录入"
Top = 240
Visible = 0 'False
Width = 2820
End
Begin VB.CommandButton Command2
Caption = "取消"
Height = 375
Left = 3600
TabIndex = 4
Top = 1320
Width = 1095
End
Begin VB.CommandButton Command1
Caption = "确定"
Height = 375
Left = 3600
TabIndex = 3
Top = 840
Width = 1095
End
Begin VB.ComboBox Combo1
Height = 300
ItemData = "frmqs.frx":000C
Left = 3600
List = "frmqs.frx":004C
TabIndex = 2
Top = 240
Width = 1095
End
Begin VB.Frame Frame1
Height = 1575
Left = 240
TabIndex = 0
Top = 120
Width = 2895
Begin VB.Label Label1
Height = 1215
Left = 360
TabIndex = 1
Top = 240
Width = 2295
End
End
Begin MSComDlg.CommonDialog CommonDialog1
Left = 0
Top = 1560
_ExtentX = 847
_ExtentY = 847
_Version = 393216
CancelError = -1 'True
Orientation = 2
End
End
Attribute VB_Name = "frmqs"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Combo1_Change()
If Val(Combo1.Text) > 20 Or Val(Combo1.Text) <= 0 Then
MsgBox "起始行超范围!", vbOKOnly Or vbInformation, "系统信息"
Combo1.Text = 1
End If
End Sub
Private Sub Combo1_KeyPress(KeyAscii As Integer)
If KeyAscii = 8 Then
Exit Sub
ElseIf KeyAscii < 48 Or KeyAscii > 57 Then
Beep
KeyAscii = 0
End If
End Sub
Private Sub Command1_Click()
If Val(Combo1.Text) > 20 Or Val(Combo1.Text) < 1 Then
MsgBox "起始行数必须在1至20之间!请重新输入。", vbOKOnly Or vbInformation, "起始行数输入错误"
Combo1.SetFocus
Exit Sub
End If
Dim frompagee, fistpage, lasepage, j As Integer 'q为起始行数,j为记录数
Dim hh As Integer
hh = Val(Combo1.Text)
'记录打印行号
With ycdck.Adodc1
.RecordSource = "select * from 台帐录入 where 承兑申请人=" & "'" & Cdsqr & "'" & "order by id asc"
.Refresh
Do
If .Recordset.EOF Then
.Recordset.MovePrevious
.Refresh '此句很重要,否则数据预览不正确
Exit Do
End If
If hh <= 20 Then
.Recordset.Fields(13).Value = hh
ElseIf hh > 20 Then
If hh Mod 20 = 0 Then
.Recordset.Fields(13).Value = 20
Else
.Recordset.Fields(13).Value = hh Mod 20
End If
End If
hh = hh + 1
.Recordset.Update
.Recordset.MoveNext
Loop
j = .Recordset.RecordCount '记录总数
End With
Unload 承兑汇票台帐
Unload DataEnvironment1
DataEnvironment1.Connection1.Open "data.mdb"
DataEnvironment1.Command1 Cdsqr
q = Val(Combo1.Text)
'On Error GoTo errorhandler '如果设置出现错误则可以手工设置
'Set obj = New PrinterControl '设置打印方向为横向
'obj.ChngOrientationLandscape
'X = SetDefaultPrinterOrientation(OrientLandscape) '设置纸张大小为A4
'errorhandler:: Printer.EndDoc
'bbb:
fistpage = 1
If (q - 1 + j) Mod 20 = 0 Then
lasepage = (q - 1 + j) / 20
ElseIf (q - 1 + j) Mod 20 > 0 Then
lasepage = (q + j + 19 - ((q - 1 + j) Mod 20)) / 20
End If
'以下代码在win95 网络打印机上出现错误。(标有 er)
CommonDialog1.Copies = 1 'er
CommonDialog1.ToPage = lasepage 'er
CommonDialog1.Min = fistpage 'er
CommonDialog1.Max = lasepage 'er
'CommonDialog1.Flags = 262148 'er
CommonDialog1.CancelError = True 'er
On Error GoTo handler 'er
CommonDialog1.ShowPrinter 'er
topagee = CommonDialog1.ToPage 'er
frompagee = CommonDialog1.FromPage 'er
topagee = lasepage
frompagee = fistpage
'If Printer.Orientation = 1 And Printer.PaperSize <> 9 Then 'er
'MsgBox "打印方向及纸张大小设置错误!" & Chr$(13) & "请设方向为横向、纸张大小为A4", vbOKOnly Or vbExclamation, "消息"
'GoTo bbb
'ElseIf Printer.Orientation = 1 Then
'MsgBox "打印方向设置错误!请设为横向", vbOKOnly Or vbExclamation, "消息"
'GoTo bbb
'ElseIf Printer.PaperSize <> 9 Then
'MsgBox "纸张大小设置错误!,请设为A4", vbOKOnly Or vbExclamation, "消息"
'GoTo bbb
'End If 'er
With 承兑汇票台帐
.LeftMargin = Bj(3) * 56.7
.RightMargin = Bj(4) * 56.7
.TopMargin = Bj(1) * 56.7
.BottomMargin = Bj(2) * 56.7
If frompagee = 1 And topagee > 1 Then
If q = 1 Then
.PrintReport False, rptRangeFromTo, frompagee, topagee
'.Show 1
Else
.Sections(2).Visible = False '页标头
.Sections(1).Height = 1245 + 427 * (q - 1) '报表标头
X = .PrintReport(False, rptRangeFromTo, 1, 1)
frm正在打印.Show 1
End If
ElseIf frompagee = 1 And topagee = 1 Then
If q = 1 Then
.PrintReport False, rptRangeFromTo, frompagee, topagee
' .Show 1
Else
.Sections(2).Visible = False
.Sections(1).Height = 1245 + 427 * (q - 1)
' .Show 1
.PrintReport False, rptRangeFromTo, 1, 1
End If
ElseIf frompagee > 1 And topagee > 1 Then
If q = 1 Then
.PrintReport False, rptRangeFromTo, frompagee, topagee
'.Show 1
Else
.Sections(2).Visible = True
.Sections(1).Height = 427 * (q - 1)
.PrintReport False, rptRangeFromTo, frompagee, topagee
'.Show 1
End If
End If
End With
hh = Val(Combo1.Text) + Dayinshu '记录一下一次的打印起始行数
If hh > 18 Then
If hh Mod 20 = 0 Then
hh = 18
Else
hh = hh Mod 20
End If
End If
With ycdck.Adodc1
.RecordSource = "select * from 承兑申请人 where 承兑申请人=" & "'" & Cdsqr & "'"
.Refresh
.Recordset.Fields(3).Value = hh
.Recordset.Update
End With
Unload Me
handler:
'obj.ReSetOrientation '恢复打印机打印方向
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
With ycdck.Adodc1
.RecordSource = "select * from 承兑申请人 where 承兑申请人=" & "'" & Cdsqr & "'"
.Refresh
On Error GoTo ccc
Me.Combo1.Text = .Recordset.Fields(3).Value
Exit Sub
ccc:
MsgBox "承兑申请人[" & Cdsqr & "]未设置或设置已删除,无法确认其打印行数!", vbOKOnly Or vbInformation, "系统信息"
End With
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -