📄 form111.frm
字号:
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.Form Form111
BackColor = &H00FFFF80&
BorderStyle = 1 'Fixed Single
Caption = "客房预定登记"
ClientHeight = 4530
ClientLeft = 45
ClientTop = 435
ClientWidth = 8790
Icon = "Form111.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4530
ScaleWidth = 8790
StartUpPosition = 1 '所有者中心
Begin VB.TextBox Txtfield
Height = 375
Index = 8
Left = 6000
TabIndex = 24
Top = 2880
Width = 1575
End
Begin VB.CommandButton Command13
Caption = "房间号"
Height = 375
Left = 5040
TabIndex = 23
Top = 2880
Width = 975
End
Begin VB.CommandButton Command12
Caption = "退出"
Height = 375
Left = 7080
TabIndex = 22
Top = 3960
Width = 1455
End
Begin VB.CommandButton Command11
Caption = "登记预定"
Height = 375
Left = 5280
TabIndex = 21
Top = 3960
Width = 1695
End
Begin VB.CommandButton Command10
Caption = "预付金额"
Height = 375
Left = 5040
TabIndex = 20
Top = 2280
Width = 975
End
Begin VB.TextBox Txtfield
Height = 375
Index = 7
Left = 6000
TabIndex = 19
Top = 2280
Width = 1575
End
Begin VB.TextBox Txtfield
Height = 375
Index = 6
Left = 6000
TabIndex = 18
Top = 1680
Width = 1215
End
Begin VB.CommandButton Command9
Caption = "预住天数"
Height = 375
Left = 5040
TabIndex = 17
Top = 1680
Width = 975
End
Begin MSComCtl2.DTPicker DTPicker1
Height = 375
Left = 6000
TabIndex = 16
Top = 1080
Width = 1815
_ExtentX = 3201
_ExtentY = 661
_Version = 393216
Format = 171507713
CurrentDate = 38708
End
Begin VB.CommandButton Command8
Caption = "预住日期"
Height = 375
Left = 5040
TabIndex = 15
Top = 1080
Width = 975
End
Begin VB.TextBox Txtfield
Height = 375
Index = 5
Left = 6000
TabIndex = 14
Top = 480
Width = 1815
End
Begin VB.CommandButton Command7
Caption = "房间价格"
Height = 375
Left = 5040
TabIndex = 13
Top = 480
Width = 975
End
Begin VB.CommandButton Command6
Caption = "房间类型"
Height = 375
Left = 360
TabIndex = 12
Top = 3480
Width = 975
End
Begin VB.ComboBox Combo2
Height = 300
ItemData = "Form111.frx":0442
Left = 1320
List = "Form111.frx":0444
TabIndex = 11
Top = 3480
Width = 1815
End
Begin VB.ComboBox Combo1
BackColor = &H00FF8080&
Height = 300
ItemData = "Form111.frx":0446
Left = 1320
List = "Form111.frx":0456
TabIndex = 10
Text = "身份证"
Top = 3000
Width = 945
End
Begin VB.CommandButton Command5
Caption = "证件号码"
Height = 375
Left = 360
TabIndex = 9
Top = 2880
Width = 975
End
Begin VB.CommandButton Command4
Caption = "详细地址"
Height = 375
Left = 360
TabIndex = 8
Top = 2280
Width = 975
End
Begin VB.CommandButton Command3
Caption = "工作单位"
Height = 375
Left = 360
TabIndex = 7
Top = 1680
Width = 975
End
Begin VB.CommandButton Command2
Caption = "联系电话"
Height = 375
Left = 360
TabIndex = 6
Top = 1080
Width = 975
End
Begin VB.CommandButton Command1
Caption = "姓名"
Height = 375
Left = 360
TabIndex = 5
Top = 480
Width = 975
End
Begin VB.TextBox Txtfield
Height = 375
Index = 4
Left = 2280
TabIndex = 4
Top = 2880
Width = 2655
End
Begin VB.TextBox Txtfield
Height = 375
Index = 3
Left = 1320
TabIndex = 3
Top = 2280
Width = 2295
End
Begin VB.TextBox Txtfield
Height = 375
Index = 2
Left = 1320
TabIndex = 2
Top = 1680
Width = 2295
End
Begin VB.TextBox Txtfield
Height = 375
Index = 1
Left = 1320
TabIndex = 1
Top = 1080
Width = 2295
End
Begin VB.TextBox Txtfield
Height = 375
Index = 0
Left = 1320
TabIndex = 0
Top = 480
Width = 2295
End
End
Attribute VB_Name = "Form111"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'FIXIT: 使用 Option Explicit 可以避免隐式创建 Variant 类型的变量 FixIT90210ae-R383-H1984
Private Sub Command11_Click()
If Trim(txtfield(0).Text) = "" Then
MsgBox "对不起,姓名必须输入? ", vbInformation, "Hello!"
txtfield(0).SetFocus
Exit Sub
End If
'FIXIT: 用 "Trim$" 函数替换 "Trim" 函数 FixIT90210ae-R9757-R1B8ZE
If Trim(txtfield(1).Text) = "" Then
MsgBox "对不起,联系电话必须输入? ", vbInformation, "Hello!"
txtfield(1).SetFocus
Exit Sub
End If
For i = 2 To 8
If txtfield(i).Text = "" Then
txtfield(i) = 0
End If
Next i
'开始保存内容
Dim db As Database
Dim EF As Recordset
Dim efc As Recordset
Set db = OpenDatabase(ConData, False, False, Constr)
Set EF = db.OpenRecordset("Select * from kfyd", dbOpenDynaset)
Set efc = db.OpenRecordset("Select * from kf where 房间号='" & txtfield(8).Text & " '", dbOpenDynaset)
'==================1
EF.AddNew
If txtfield(8).Text <> "" Then efc.Edit
efc("房态") = "预订"
EF("姓名") = txtfield(0).Text
EF("联系电话") = txtfield(1).Text
EF("工作单位") = txtfield(2).Text
EF("详细地址") = txtfield(3).Text
EF("身份证号") = txtfield(4).Text
EF("房间价格") = txtfield(5).Text
EF("客房类型") = Combo2
EF("证件名称") = Combo1
EF("预住天数") = txtfield(6).Text
EF("日期") = Date
EF("时间") = Format(Now, "hh:mm:ss")
EF("预住日期") = DTPicker1
EF("预付金额") = txtfield(7).Text
EF("备注") = txtfield(8).Text
EF("操作员") = MDIForm1.StatusBar1.Panels(4).Text
efc.Update
EF.Update
'-----------------2
'-----------------
efc.Close
EF.Close
db.Close
' Caozuo = "客房预定按钮 "
'lu_time = Now
'RiZhil
MsgBox "预定已经录入 ", vbInformation
For i = 0 To 8
txtfield(i) = ""
Next
End Sub
Private Sub Command12_Click()
Unload Me
End Sub
Private Sub Form_Load()
'retValue = SetWindowPos(Me.hwnd, HWND_TOPMOST, Me.CurrentX, Me.CurrentY, 11880, 8280, SWP_SHOWWINDOW)
sAppPath = App.Path
'FIXIT: 用 "Right$" 函数替换 "Right" 函数 FixIT90210ae-R9757-R1B8ZE
If Right(App.Path, 1) = "\" Then
sAppPath = App.Path
Else
sAppPath = App.Path & "\"
End If
Dim db As Database
Dim EF As Recordset
Set db = OpenDatabase(ConData, False, True, Constr)
Set EF = db.OpenRecordset("select * from kflx", dbOpenDynaset)
If Not (EF.BOF And EF.EOF) Then
Do While Not EF.EOF
Combo2.AddItem EF("客房类型")
EF.MoveNext
Loop
End If
EF.Close
db.Close
End Sub
Private Sub txtField_KeyDown(Index As Integer, KeyCode As Integer, Shift As Integer)
If KeyCode = 38 Then
'自动上移
If Index > 0 Then '最后一个文本框
txtfield(Index - 1).SetFocus
Else
txtfield(8).SetFocus '返回
End If
Exit Sub
End If
If KeyCode = 40 Then
'自动下跳
If Index < 8 Then '最后一个文本框
txtfield(Index + 1).SetFocus
Else
txtfield(0).SetFocus '返回
End If
Exit Sub
End If
End Sub
Private Sub txtField_KeyPress(Index As Integer, KeyAscii As Integer)
If KeyAscii = 13 Then
'自动下跳
If Index < 8 Then '最后一个文本框
txtfield(Index + 1).SetFocus
Else
txtfield(0).SetFocus '返回
End If
Exit Sub
End If
'判断是否为正确输入
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -