📄 frmrent.frm
字号:
VERSION 5.00
Begin VB.Form frmrent
BackColor = &H00C0FFFF&
Caption = "Rental"
ClientHeight = 6105
ClientLeft = 60
ClientTop = 450
ClientWidth = 4590
Icon = "frmrent.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
Picture = "frmrent.frx":0E42
ScaleHeight = 6105
ScaleWidth = 4590
StartUpPosition = 3 'Windows Default
Begin VB.TextBox txttitle
Height = 495
Left = 1800
Locked = -1 'True
TabIndex = 14
Top = 2760
Width = 2535
End
Begin VB.PictureBox picname
BackColor = &H00C0C0C0&
Height = 495
Left = 1800
ScaleHeight = 435
ScaleWidth = 2475
TabIndex = 13
Top = 1320
Width = 2535
End
Begin VB.PictureBox picdue
AutoRedraw = -1 'True
BackColor = &H00C0C0C0&
Height = 495
Left = 1800
ScaleHeight = 435
ScaleWidth = 2475
TabIndex = 11
Top = 4200
Width = 2535
End
Begin VB.Data Data3
Caption = "Data3"
Connect = "Access"
DatabaseName = ""
DefaultCursorType= 0 'DefaultCursor
DefaultType = 2 'UseODBC
Exclusive = 0 'False
Height = 345
Left = 2880
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = ""
Top = 5640
Visible = 0 'False
Width = 1215
End
Begin VB.Data Data2
Caption = "Data2"
Connect = "Access"
DatabaseName = ""
DefaultCursorType= 0 'DefaultCursor
DefaultType = 2 'UseODBC
Exclusive = 0 'False
Height = 345
Left = 1560
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = ""
Top = 5640
Visible = 0 'False
Width = 1215
End
Begin VB.Data Data1
Caption = "Data1"
Connect = "Access"
DatabaseName = ""
DefaultCursorType= 0 'DefaultCursor
DefaultType = 2 'UseODBC
Exclusive = 0 'False
Height = 345
Left = 240
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = ""
Top = 5640
Visible = 0 'False
Width = 1215
End
Begin VB.Timer Timer1
Interval = 10
Left = 2520
Top = 0
End
Begin VB.CommandButton cmdcancel
Caption = "&Cancel"
Height = 495
Left = 2400
TabIndex = 8
Top = 5040
Width = 1215
End
Begin VB.CommandButton Cmdrent
Caption = "&Rent"
Height = 495
Left = 840
TabIndex = 7
Top = 5040
Width = 1215
End
Begin VB.TextBox txtdrent
Height = 495
Left = 1800
TabIndex = 6
Top = 3480
Width = 2535
End
Begin VB.TextBox txtcode
Height = 495
Left = 1800
TabIndex = 5
Top = 2040
Width = 2535
End
Begin VB.TextBox txtid
Height = 495
Left = 1800
TabIndex = 4
Top = 600
Width = 2535
End
Begin VB.Label lbltime
BackColor = &H00FFC0C0&
BackStyle = 0 'Transparent
Height = 495
Left = 3720
TabIndex = 12
Top = 120
Width = 1215
End
Begin VB.Label lbldue
BackColor = &H00FFC0C0&
BackStyle = 0 'Transparent
Caption = "Due Date:"
Height = 495
Index = 0
Left = 240
TabIndex = 10
Top = 4320
Width = 1335
End
Begin VB.Label lblname
BackColor = &H00FFC0C0&
BackStyle = 0 'Transparent
Caption = "Member Name:"
Height = 495
Left = 240
TabIndex = 9
Top = 1440
Width = 1215
End
Begin VB.Label lbldate
BackColor = &H00FFC0C0&
BackStyle = 0 'Transparent
Caption = "Date of Rental:"
Height = 495
Left = 240
TabIndex = 3
Top = 3600
Width = 1215
End
Begin VB.Label lblcode
BackColor = &H00FFC0C0&
BackStyle = 0 'Transparent
Caption = "Video Code:"
Height = 495
Left = 240
TabIndex = 2
Top = 2160
Width = 1215
End
Begin VB.Label lbltitle
BackColor = &H00FFC0C0&
BackStyle = 0 'Transparent
Caption = "Video Title:"
Height = 495
Left = 240
TabIndex = 1
Top = 2880
Width = 1215
End
Begin VB.Label lblid
BackColor = &H00FFC0C0&
BackStyle = 0 'Transparent
Caption = "Member ID:"
Height = 495
Left = 240
TabIndex = 0
Top = 720
Width = 1215
End
End
Attribute VB_Name = "frmrent"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdcancel_Click()
Unload Me
End Sub
Private Sub cmdrent_Click()
If txtid.Text <> "" Then
If txtcode <> "" Then
With Data1.Recordset
.AddNew
!member_id = txtid
!video_title = txttitle
!video_code = txtcode
!due = Date + 7
!borrow = txtdrent
.Update
MsgBox "Data Added!!", vbInformation
End With
With Data2.Recordset
.FindFirst ("id='" & txtid & "'")
If .NoMatch = False Then
Call addpay
End If
txtid = ""
txttitle = ""
txtcode = ""
picdue.Cls
picname.Cls
End With
Else
MsgBox "Please enter the video code!", vbExclamation
End If
Else
MsgBox "Please enter the member ID!", vbExclamation
End If
End Sub
Private Sub Form_Load()
Data1.DatabaseName = App.Path & "/video.mdb"
Data1.RecordSource = " select * from rent_return"
Data2.DatabaseName = App.Path & "/video.mdb"
Data2.RecordSource = " select * from member"
Data3.DatabaseName = App.Path & "/video.mdb"
Data3.RecordSource = " select * from video"
txtdrent.Text = Date
picdue.Print Date + 7
End Sub
Private Sub Timer1_Timer()
lbltime.Caption = Time$
End Sub
Private Sub txtid_KeyPress(KeyAscii As Integer)
If KeyAscii = vbKeyReturn Then
Call DisplayName
End If
End Sub
Private Sub DisplayName()
With Data2.Recordset
.FindFirst ("id='" & txtid & "'")
If .NoMatch = False Then
picname.Print !Name
Else
MsgBox "The customer is not a member yet", vbExclamation
txtid.Text = ""
End If
End With
End Sub
Private Sub txtcode_keypress(KeyAscii As Integer)
If KeyAscii = vbKeyReturn Then
Call displaytitle
End If
End Sub
Private Sub displaytitle()
With Data3.Recordset
.FindFirst ("code='" & txtcode & "'")
If .NoMatch = False Then
txttitle = !Title
Else
MsgBox "The video is not available yet", vbExclamation
End If
End With
End Sub
Private Sub addpay()
With Data2.Recordset
.Edit
!amount_due = !amount_due + 3
.Update
End With
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -