?? frmprint.frm
字號(hào):
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 = "退 出"
font = "Frmprint.frx":57F4
End
Begin Project1.xpcmdbutton Command1
Height = 495
Left = 600
TabIndex = 6
Top = 3360
Width = 1455
_extentx = 2566
_extenty = 873
caption = "打印借書憑證"
font = "Frmprint.frx":5818
End
Begin VB.Frame Frame2
BackColor = &H00FFFFFF&
Height = 1455
Left = 120
TabIndex = 4
Top = 1560
Width = 4935
Begin VB.Label Label2
BackColor = &H00FFFFFF&
Height = 855
Left = 960
TabIndex = 5
Top = 360
Width = 2895
End
End
Begin VB.Frame Frame1
BackColor = &H00FFFFFF&
Height = 495
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 = 345
Left = 1440
TabIndex = 3
Top = 120
Width = 2775
End
Begin VB.Label Label1
BackColor = &H00FFFFFF&
Caption = "讀者工號(hào):"
Height = 375
Left = 360
TabIndex = 2
Top = 120
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() '點(diǎn)擊打印借書憑證按鈕
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 '讀者工號(hào)欄為空
frmMsg.Show
frmMsg.notice.Visible = True
frmMsg.Text1.Text = "請輸入讀者工號(hào)!"
Exit Sub
End If
sqltxt = "select * from record where [工號(hào)]='" & Trim(Text1.Text) & "'" '去除文本框的空格,從表中查找工號(hào)
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
'打印標(biāo)題定義
printtile = Space(100) & "工號(hào)" & Space(10) & "書名 " & Space(25) & "借書時(shí)間"
'打印數(shù)據(jù)付值(打印某一個(gè)人的所有借閱圖書信息憑條)
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 '如果沒有記錄,則報(bào)錯(cuò)
Label2.Caption = "打印失敗,借閱數(shù)據(jù)與圖書數(shù)據(jù)不匹配!"
Exit Sub
End If
printtext = printtext & Space(100) & rst1![工號(hào)] & Space(10) & rst2![圖書名稱] & Space(20) & str(rst1![借閱時(shí)間]) & 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 = "沒有發(fā)現(xiàn)打印機(jī),請先安裝打印機(jī)!"
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
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -