📄 yudingfangjian.frm
字号:
VERSION 5.00
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.Form yudingfangjian
Caption = "预定房间"
ClientHeight = 5220
ClientLeft = 60
ClientTop = 345
ClientWidth = 5460
Icon = "yudingfangjian.frx":0000
LinkTopic = "Form1"
ScaleHeight = 5220
ScaleWidth = 5460
StartUpPosition = 3 '窗口缺省
Begin VB.Frame Frame2
Height = 975
Left = 0
TabIndex = 1
Top = 4200
Width = 5415
Begin VB.CommandButton Command3
Caption = "返回"
Height = 500
Left = 3120
TabIndex = 16
Top = 240
Width = 1500
End
Begin VB.CommandButton Command1
Caption = "添加"
Height = 500
Left = 960
TabIndex = 15
Top = 240
Width = 1500
End
End
Begin VB.Frame Frame1
Caption = "预定房间"
Height = 4095
Left = 0
TabIndex = 0
Top = 0
Width = 5415
Begin MSComCtl2.DTPicker DTPicker1
Height = 300
Left = 3960
TabIndex = 25
Top = 720
Width = 1215
_ExtentX = 2143
_ExtentY = 529
_Version = 393216
Format = 62390273
CurrentDate = 39227
End
Begin VB.ComboBox Combo4
Height = 300
Left = 3960
TabIndex = 24
Top = 1680
Width = 1215
End
Begin VB.ComboBox Combo1
Height = 300
Index = 1
ItemData = "yudingfangjian.frx":058A
Left = 1200
List = "yudingfangjian.frx":058C
TabIndex = 22
Top = 1680
Width = 1575
End
Begin VB.TextBox Text6
Height = 735
Left = 1200
TabIndex = 20
Top = 3120
Width = 2655
End
Begin VB.TextBox Text5
Height = 270
Left = 1200
TabIndex = 18
Top = 2640
Width = 2655
End
Begin VB.TextBox Text4
Height = 300
Left = 3960
TabIndex = 14
Top = 1200
Width = 1215
End
Begin VB.TextBox Text3
Height = 300
Left = 1200
TabIndex = 13
Top = 2160
Width = 2655
End
Begin VB.ComboBox Combo3
Height = 300
Left = 3960
TabIndex = 12
Top = 240
Width = 1215
End
Begin VB.ComboBox Combo1
Height = 300
Index = 0
Left = 1200
TabIndex = 11
Top = 720
Width = 1575
End
Begin VB.TextBox Text2
Height = 300
Left = 1200
TabIndex = 10
Top = 1200
Width = 1575
End
Begin VB.TextBox Text1
Height = 300
Left = 1200
TabIndex = 9
Top = 240
Width = 1575
End
Begin VB.Label Label11
Caption = "折扣:"
Height = 255
Left = 3120
TabIndex = 23
Top = 1680
Width = 615
End
Begin VB.Label Label10
Caption = "客房单价:"
Height = 255
Left = 240
TabIndex = 21
Top = 1680
Width = 735
End
Begin VB.Label Label9
Caption = "备注信息:"
Height = 255
Left = 240
TabIndex = 19
Top = 3120
Width = 855
End
Begin VB.Label Label8
Caption = "预订人单位:"
Height = 255
Left = 120
TabIndex = 17
Top = 2640
Width = 1095
End
Begin VB.Label Label7
Caption = "预订天数:"
Height = 375
Left = 3120
TabIndex = 8
Top = 1200
Width = 855
End
Begin VB.Label Label6
Caption = "预订时间:"
Height = 255
Left = 3120
TabIndex = 7
Top = 720
Width = 855
End
Begin VB.Label Label5
Caption = "电话号码:"
Height = 255
Left = 240
TabIndex = 6
Top = 2160
Width = 855
End
Begin VB.Label Label4
Caption = "性别:"
Height = 255
Left = 3120
TabIndex = 5
Top = 240
Width = 615
End
Begin VB.Label Label3
Caption = "预订人数:"
Height = 255
Left = 240
TabIndex = 4
Top = 1200
Width = 855
End
Begin VB.Label Label2
Caption = "房间类型:"
Height = 255
Left = 240
TabIndex = 3
Top = 720
Width = 855
End
Begin VB.Label Label1
Caption = "姓名:"
Height = 375
Left = 240
TabIndex = 2
Top = 240
Width = 855
End
End
End
Attribute VB_Name = "yudingfangjian"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub Combo1_Click(Index As Integer)
Set db = OpenDatabase(App.Path & "\客房情况")
Set rs = db.OpenRecordset("客房情况")
Set rs = db.OpenRecordset("select 单价 from 客房情况 where 客房类型 ='" & Trim(Combo1(0)) & "'")
Dim i As String
Dim t As Integer
If Index = 0 Then
Combo1(1).Clear
If Not rs.EOF Then
With Combo1(1)
Do While Not rs.EOF
.AddItem Trim(rs!单价)
rs.MoveNext
Loop
ListIndex = 0
End With
Command1.Enabled = True
Else
MsgBox "房间信息建档不正确 !", vbOKOnly + vbExclamation, "警告!"
Command1.Enabled = False
Exit Sub
End If
ElseIf Index = 1 Then
rs.MoveFirst
rs.Move Combo1(1).ListIndex
End If
End Sub
Private Sub Command1_Click() '老是添加不进去,死机
Dim db As Database
Dim rs As Recordset
Set db = OpenDatabase(App.Path & "\预定房间.mdb")
Set rs = db.OpenRecordset("预定房间")
Dim i As String
If Text1.Text <> "" Then
If Val(Trim(Text2.Text)) <= 9999 And Val(Trim(Text2.Text)) >= 0 Then
If Len(Trim(Text3.Text)) <= 12 And Len(Trim(Text3.Text)) >= 0 And Val(Trim(Text3.Text)) <= 999999999999# And Val(Trim(Text3.Text)) >= 0 Then
i = MsgBox("你确定预定吗?", vbOKCancel)
If i = 1 Then
rs.AddNew
rs.Fields(0) = Text1
rs.Fields(1) = Combo3
rs.Fields(2) = Text3
rs.Fields(3) = Text5
rs.Fields(4) = DTPicker1.Value
rs.Fields(5) = Text4
rs.Fields(6) = Text2
rs.Fields(7) = Combo1(0)
rs.Fields(8) = Combo1(1)
rs.Fields(9) = Combo4
rs.Fields(10) = Text6
rs.Update
MsgBox "添加成功!"
Text1.Text = ""
Combo3.Text = ""
Combo4.Text = ""
Text3.Text = ""
Text5.Text = ""
Text4.Text = ""
Text2.Text = ""
Text6.Text = ""
Combo1(0).Text = ""
Combo1(1).Text = ""
End If
Else
MsgBox "电话有错误,请重试!"
End If
Else
MsgBox "人数错误,请重试!"
End If
Else
MsgBox "请输入姓名,请重试!"
End If
End Sub
Private Sub Command3_Click()
yudingfangjian.Hide
caidan.Show
End Sub
Private Sub Form_Load()
Combo3.AddItem "女"
Combo3.AddItem "男"
Combo4.AddItem "100%"
Combo4.AddItem "90%"
Combo4.AddItem "80%"
Combo4.AddItem "70%"
Combo4.AddItem "60%"
Combo4.AddItem "50%"
Combo4.AddItem "40%"
Combo4.AddItem "30%"
Combo4.AddItem "20%"
Combo4.AddItem "10%"
Combo4.AddItem "0%"
Set db = OpenDatabase(App.Path & "\客房情况")
Set rs = db.OpenRecordset("客房情况")
Set rs = db.OpenRecordset("select distinct 客房类型 from 客房情况")
If Not rs.EOF Then
Do While Not rs.EOF
Combo1(0).AddItem Trim(rs!客房类型)
rs.MoveNext
Loop
Combo1(0).ListIndex = 0
Else
MsgBox "请检查客房信息档案!", vbOKOnly + vbExclamation, "警告"
Command1.Enabled = False
Exit Sub
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -