📄 frmroomedit.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX"
Begin VB.Form FrmRoomEdit
BorderStyle = 1 'Fixed Single
Caption = "客房信息"
ClientHeight = 4140
ClientLeft = 45
ClientTop = 330
ClientWidth = 6735
Icon = "FrmRoomEdit.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 4140
ScaleWidth = 6735
StartUpPosition = 2 '屏幕中心
Begin MSDataListLib.DataCombo dco_RType
Height = 330
Left = 4680
TabIndex = 13
Top = 120
Width = 1695
_ExtentX = 2990
_ExtentY = 582
_Version = 393216
Style = 2
ListField = ""
BoundColumn = ""
Text = ""
End
Begin MSAdodcLib.Adodc Ado_RType
Height = 375
Left = 3600
Top = 1080
Visible = 0 'False
Width = 1815
_ExtentX = 3201
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "Ado_RType"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin VB.TextBox txtPrice
Height = 270
Left = 4680
TabIndex = 12
Top = 615
Width = 1695
End
Begin VB.ComboBox ComboStatus
Height = 300
ItemData = "FrmRoomEdit.frx":0CCA
Left = 1320
List = "FrmRoomEdit.frx":0CDD
Style = 2 'Dropdown List
TabIndex = 11
Top = 1065
Width = 1695
End
Begin VB.TextBox txtList
Height = 1695
Left = 1320
TabIndex = 10
Top = 1560
Width = 5295
End
Begin VB.ComboBox cmbDrt
Height = 300
ItemData = "FrmRoomEdit.frx":0CFF
Left = 1320
List = "FrmRoomEdit.frx":0D1B
Style = 2 'Dropdown List
TabIndex = 9
Top = 600
Width = 1695
End
Begin VB.TextBox txtRId
Height = 270
Left = 1320
TabIndex = 8
Top = 150
Width = 1695
End
Begin VB.CommandButton Command2
Caption = "关 闭"
Height = 495
Left = 3660
TabIndex = 7
Top = 3480
Width = 1095
End
Begin VB.CommandButton Cmd_OK
Caption = "确 定"
Height = 495
Left = 1980
TabIndex = 6
Top = 3480
Width = 1095
End
Begin VB.Label Label6
AutoSize = -1 'True
Caption = "状 态"
Height = 180
Left = 240
TabIndex = 5
Top = 1125
Width = 540
End
Begin VB.Label Label5
AutoSize = -1 'True
Caption = "价 格"
Height = 180
Left = 3480
TabIndex = 4
Top = 660
Width = 540
End
Begin VB.Label Label4
AutoSize = -1 'True
Caption = "物品清单"
Height = 180
Left = 240
TabIndex = 3
Top = 1560
Width = 720
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "房间朝向"
Height = 180
Left = 240
TabIndex = 2
Top = 660
Width = 720
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "客房类型"
Height = 180
Left = 3480
TabIndex = 1
Top = 195
Width = 720
End
Begin VB.Label Label1
AutoSize = -1 'True
Caption = "客房编号"
Height = 180
Left = 240
TabIndex = 0
Top = 195
Width = 720
End
End
Attribute VB_Name = "FrmRoomEdit"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public Modify As Boolean
Public OrgRId As String '原始的客房编号
Private Sub Cmd_OK_Click()
'判断主要域是否为空,其中客房编号、客房类型、价格必须输入
If Trim(txtRId.Text) = "" Then
MsgBox "请输入客房编号"
txtRId.SetFocus
Exit Sub
End If
If Trim(dco_RType.Text) = "" Then
MsgBox "请输入客房类型"
dco_RType.SetFocus
Exit Sub
End If
If Trim(txtPrice.Text) = "" Then
MsgBox "请输入客房价格"
txtPrice.SetFocus
Exit Sub
End If
With MyRoom
.RoomNo = MakeStr(txtRId.Text)
'dco_RType.BoundText是当前选择房间类型的TypeId字段值
.TypeId = Val(dco_RType.BoundText)
.Position = MakeStr(cmbDrt.Text)
.ObjList = MakeStr(txtList.Text)
.Price = Val(txtPrice.Text)
'空房、入住、预留、退房、维修
If Trim(ComboStatus.Text) = "空房" Then
.Status = 0
ElseIf Trim(ComboStatus.Text) = "预留" Then
.Status = 1
ElseIf Trim(ComboStatus.Text) = "入住" Then
.Status = 2
ElseIf Trim(ComboStatus.Text) = "退房" Then
.Status = 3
ElseIf Trim(ComboStatus.Text) = "维修" Then
.Status = 4
End If
If Modify = False Then
'插入新记录
.Insert
Else
If Trim(txtRId.Text) = OrgRId Then
'如果原始编号等于现有编号,则修改记录;
.Update (OrgRId)
Else
'如果原始编号不等于现有编号,而且表没有此新的编号,则修改记录;
If .In_DB(OrgRId) = True Then
.Update (OrgRId)
Else
MsgBox "已经存在此客房编号,请重新输入客房编号"
txtRId.SetFocus
Exit Sub
End If
End If
End If
End With
FrmRoomMan.Adodc2.Refresh
Unload Me
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
Ado_RType.ConnectionString = Conn
Ado_RType.RecordSource = "Select * From RoomType Order By TypeId"
Ado_RType.Refresh
Set dco_RType.RowSource = Ado_RType
dco_RType.ListField = "TypeName"
dco_RType.BoundColumn = "TypeId"
End Sub
Private Sub txtPrice_KeyPress(KeyAscii As Integer)
If In_Single(KeyAscii) = False Then
KeyAscii = 0
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -