?? frmprint.frm
字號:
VERSION 5.00
Begin VB.Form Frmprint
Appearance = 0 'Flat
AutoRedraw = -1 'True
BackColor = &H80000005&
BorderStyle = 0 'None
Caption = "打印憑證"
ClientHeight = 4470
ClientLeft = 5220
ClientTop = 3165
ClientWidth = 5265
LinkTopic = "Form8"
ScaleHeight = 298
ScaleMode = 3 'Pixel
ScaleWidth = 351
ShowInTaskbar = 0 'False
Begin Project1.xp_canvas xp_canvas1
Height = 4455
Left = 0
TabIndex = 0
Top = 0
Width = 5175
_ExtentX = 9128
_ExtentY = 7858
Caption = "打印憑證"
Icon = "Frmprint.frx":0000
Begin Project1.xpcmdbutton Command2
Height = 495
Left = 2640
TabIndex = 7
Top = 3360
Width = 1575
_ExtentX = 2778
_ExtentY = 873
Caption = "退 出"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin Project1.xpcmdbutton Command1
Height = 495
Left = 600
TabIndex = 6
Top = 3360
Width = 1455
_ExtentX = 2566
_ExtentY = 873
Caption = "打印借書憑證"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
End
Begin VB.Frame Frame2
Height = 1455
Left = 120
TabIndex = 4
Top = 1560
Width = 4935
Begin VB.Label Label2
BeginProperty Font
Name = "宋體"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 855
Left = 960
TabIndex = 5
Top = 360
Width = 2895
End
End
Begin VB.Frame Frame1
Height = 1095
Left = 120
TabIndex = 1
Top = 480
Width = 4935
Begin VB.TextBox Text1
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 1920
TabIndex = 3
Top = 240
Width = 2775
End
Begin VB.Label Label1
Caption = "讀者工號:"
BeginProperty Font
Name = "宋體"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 240
TabIndex = 2
Top = 240
Width = 1455
End
End
Begin Project1.xptopbuttons xptopbuttons2
Height = 315
Left = 4440
Top = 120
Width = 315
_ExtentX = 556
_ExtentY = 556
Value = 2
End
Begin Project1.xptopbuttons xptopbuttons1
Height = 315
Left = 4800
Top = 120
Width = 315
_ExtentX = 556
_ExtentY = 556
End
End
End
Attribute VB_Name = "Frmprint"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'圖書借閱憑條打印功能
Private Sub Command1_Click() '點擊打印借書憑證按鈕
On Error GoTo errhandle
Dim sqltxt, printtile, printtext As String
Dim rst1 As ADODB.Recordset
Dim rst2 As ADODB.Recordset
Set rst1 = New ADODB.Recordset
If Text1.Text = "" Then '讀者工號欄為空
frmMsg.Show
frmMsg.notice.Visible = True
frmMsg.Text1.Text = "請輸入讀者工號!"
Exit Sub
End If
sqltxt = "select * from record where [工號]='" & Trim(Text1.Text) & "'" '去除文本框的空格,從表中查找工號
rst1.Open sqltxt, con, 1, 3
If rst1.RecordCount > 0 Then '如果有記錄,則顯示第一條
rst1.MoveFirst
Else
frmMsg.Show
frmMsg.error.Visible = True
frmMsg.Text1.Text = "對不起,沒有此用戶記錄!"
Exit Sub
End If
'打印標題定義
printtile = Space(100) & "工號" & Space(10) & "書名 " & Space(25) & "借書時間"
'打印數據付值(打印某一個人的所有借閱圖書信息憑條)
Do While (Not rst1.EOF)
sqltext = "select * from book where [圖書編碼]='" & rst1![圖書編碼] & "'"
Set rst2 = New ADODB.Recordset
rst2.Open sqltext, con, 1, 3
If rst2.RecordCount <= 0 Then '如果沒有記錄,則報錯
Label2.Caption = "打印失敗,借閱數據與圖書數據不匹配!"
Exit Sub
End If
printtext = printtext & Space(100) & rst1![工號] & Space(10) & rst2![圖書名稱] & Space(20) & str(rst1![借閱時間]) & Chr(13) & Chr(10)
Set rst2 = Nothing
rst1.MoveNext
Loop
Printer.Print printtile
Printer.Print printtext
Label2.Caption = "打印成功!"
Set rst1 = Nothing
Exit Sub
errhandle:
frmMsg.Show
frmMsg.error.Visible = True
frmMsg.Text1.Text = "沒有發現打印機,請先安裝打印機!"
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub xptopbuttons1_Click()
Unload Me
End Sub
Private Sub xptopbuttons2_Click()
Me.WindowState = 1
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -