?? frmborrow.frm
字號:
Width = 1215
End
End
Begin VB.Frame Frame1
Caption = "借閱人"
BeginProperty Font
Name = "宋體"
Size = 11.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 855
Left = 120
TabIndex = 7
Top = 120
Width = 6735
Begin VB.TextBox txtPNo
BeginProperty Font
Name = "宋體"
Size = 11.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 720
TabIndex = 0
Top = 240
Width = 1215
End
Begin VB.TextBox txtDepartment
Enabled = 0 'False
BeginProperty Font
Name = "宋體"
Size = 11.25
Charset = 134
Weight = 400
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 4560
TabIndex = 11
Top = 240
Width = 1815
End
Begin VB.TextBox txtPName
Enabled = 0 'False
BeginProperty Font
Name = "宋體"
Size = 11.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 2640
TabIndex = 9
Top = 240
Width = 975
End
Begin VB.Label Label4
Caption = "部門:"
BeginProperty Font
Name = "宋體"
Size = 11.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 3960
TabIndex = 12
Top = 360
Width = 1215
End
Begin VB.Label Label3
Caption = "姓名:"
BeginProperty Font
Name = "宋體"
Size = 11.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 2040
TabIndex = 10
Top = 360
Width = 1215
End
Begin VB.Label Label2
Caption = "編號:"
BeginProperty Font
Name = "宋體"
Size = 11.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = 120
TabIndex = 8
Top = 360
Width = 1215
End
End
Begin VB.CommandButton cmdExit
Caption = "退出(&X)"
BeginProperty Font
Name = "宋體"
Size = 11.25
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 6000
TabIndex = 6
Top = 3600
Width = 1215
End
End
Attribute VB_Name = "frmBorrow"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim cnn As New ADODB.Connection
Dim rst As New ADODB.Recordset
Private Sub cmdAdd_Click()
Dim BookNo As String
BookNo = txtBNo.Text
For i = 0 To lstBook.ListCount - 1
If lstBook.List(i) = BookNo Then
MsgBox "該書已經選擇", , "信息"
txtBNo.SetFocus
Exit Sub
End If
Next
lstBook.AddItem BookNo
txtBNo.SetFocus
End Sub
Private Sub cmdCancel_Click()
txtPNo.Text = ""
txtBNo.Text = ""
End Sub
Private Sub cmdDelete_Click()
lstBook.RemoveItem lstBook.ListIndex
txtBNo.SetFocus
End Sub
Private Sub cmdExit_Click()
Unload Me
End Sub
Private Sub cmdOK_Click()
Dim yn
Dim pstr As String, cnnstr As String
If lstBook.ListCount < 0 Then Exit Sub
If lstBook.ListIndex = -1 Then
yn = MsgBox("請選擇借閱圖書的編號", 36, "信息")
Exit Sub
End If
Dim rststr As String
rststr = "select * from borrow where ( borrow.BNo='" & lstBook.List(lstBook.ListIndex) & "') and (borrow.PNo='" & txtPNo.Text & "'and [to]=Null) "
rst.Open rststr, cnn, adOpenKeyset, adLockOptimistic, adCmdText
If rst.RecordCount >= 1 Then
MsgBox "該書已經被借閱", , "信息"
rst.Close
Exit Sub
Else
rst.Close
End If
pstr = "insert into borrow([PNo],[BNo],[From]) values('" & txtPNo.Text & "','"
cnnstr = pstr & lstBook.List(lstBook.ListIndex) & "',#" & Date & "#)"
cnn.Execute cnnstr
End Sub
Private Sub Form_Load()
Me.Move (frmMain.ScaleWidth - Me.Width) / 2, (frmMain.ScaleHeight - Me.Height) / 2
Dim strcnn As String
strcnn = "Provider=Microsoft.Jet.OLEDB.3.51;Persist Security Info=False;Data Source=" & App.Path & "\BookManage.mdb"
cnn.Open (strcnn)
End Sub
Private Sub Form_Unload(Cancel As Integer)
cnn.Close
End Sub
Private Sub txtBNo_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
If txtBNo.Text = "" Then Exit Sub
Dim rststr As String
rststr = "select * from Book where [No]='" & txtBNo.Text & "'"
rst.Open rststr, cnn, adOpenKeyset, adLockOptimistic, adCmdText
If rst.RecordCount < 1 Then
MsgBox "未找到記錄,請重新輸入。", , "信息"
txtBNo.SetFocus
rst.Close
Exit Sub
End If
txtBName.Text = rst!Name
Txtauthor.Text = rst!author
Txtpublisher.Text = rst!publisher
rst.Close
End If
End Sub
Private Sub txtPNo_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then txtPNo_LostFocus: txtBNo.SetFocus
End Sub
Private Sub txtPNo_LostFocus()
If txtPNo.Text = "" Then Exit Sub
Dim rststr As String
rststr = "select * from Person where [No]='" & txtPNo.Text & "'"
rst.Open rststr, cnn, adOpenKeyset, adLockOptimistic, adCmdText
If rst.RecordCount < 1 Then
MsgBox "未找到記錄,請重新輸入。", , "信息"
txtPNo.SetFocus
rst.Close
Exit Sub
End If
txtPName.Text = rst!Name
txtDepartment.Text = rst!Department
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -