📄 frmroomtype.frm
字号:
VERSION 5.00
Begin VB.Form frmRoomtype
Caption = "客房标准添加"
ClientHeight = 4755
ClientLeft = 60
ClientTop = 345
ClientWidth = 8310
LinkTopic = "Form1"
ScaleHeight = 4755
ScaleWidth = 8310
StartUpPosition = 3 '窗口缺省
Begin VB.CommandButton cmdReturn
Caption = "返回"
Height = 375
Left = 4680
TabIndex = 21
Top = 4200
Width = 1095
End
Begin VB.CommandButton cmdSave
Caption = "保存"
Height = 375
Left = 1320
TabIndex = 20
Top = 4200
Width = 1095
End
Begin VB.ComboBox Combo3
Height = 300
Left = 5760
TabIndex = 15
Text = " 否"
Top = 1800
Width = 1095
End
Begin VB.Frame Frame1
Caption = "客房标准:"
Height = 3735
Left = 360
TabIndex = 0
Top = 240
Width = 7815
Begin VB.ComboBox Combo4
Height = 300
Left = 5400
TabIndex = 18
Text = " 否"
Top = 2040
Width = 1095
End
Begin VB.ComboBox Combo2
Height = 300
Left = 5400
TabIndex = 14
Text = " 否"
Top = 960
Width = 1095
End
Begin VB.ComboBox Combo1
Height = 300
ItemData = "FRMROO~1.frx":0000
Left = 5400
List = "FRMROO~1.frx":000A
TabIndex = 12
Text = " 否"
Top = 480
Width = 1095
End
Begin VB.TextBox Text5
Height = 390
Left = 1320
TabIndex = 10
Top = 2760
Width = 1455
End
Begin VB.TextBox Text4
Height = 390
Left = 1320
TabIndex = 8
Top = 2160
Width = 1455
End
Begin VB.TextBox Text3
Height = 390
Left = 1320
TabIndex = 6
Top = 1560
Width = 1455
End
Begin VB.TextBox Text2
Height = 390
Left = 1320
TabIndex = 4
Top = 960
Width = 1455
End
Begin VB.TextBox Text1
Height = 390
Left = 1320
TabIndex = 2
Top = 360
Width = 1455
End
Begin VB.Label Label10
Caption = "/每天"
Height = 375
Left = 3000
TabIndex = 19
Top = 2880
Width = 495
End
Begin VB.Label Label9
Caption = "是否有卫生间:"
Height = 255
Left = 4080
TabIndex = 17
Top = 2040
Width = 1215
End
Begin VB.Label Label8
Caption = "是否有电视:"
Height = 255
Left = 4200
TabIndex = 16
Top = 1560
Width = 1095
End
Begin VB.Label Label7
Caption = "是否有电话:"
Height = 255
Left = 4200
TabIndex = 13
Top = 960
Width = 1095
End
Begin VB.Label Label6
Caption = "是否有空调:"
Height = 255
Left = 4200
TabIndex = 11
Top = 480
Width = 1095
End
Begin VB.Label Label5
Caption = "住房单价:"
Height = 255
Left = 480
TabIndex = 9
Top = 2880
Width = 855
End
Begin VB.Label Label4
Caption = "床位数量:"
Height = 255
Left = 480
TabIndex = 7
Top = 2280
Width = 855
End
Begin VB.Label Label3
Caption = "房间面积:"
Height = 255
Left = 480
TabIndex = 5
Top = 1680
Width = 855
End
Begin VB.Label Label2
Caption = "标准名称:"
Height = 255
Left = 480
TabIndex = 3
Top = 1080
Width = 855
End
Begin VB.Label Label1
Caption = "标准编号:"
Height = 255
Left = 480
TabIndex = 1
Top = 480
Width = 855
End
End
End
Attribute VB_Name = "frmRoomtype"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdReturn_Click()
Unload Me
End Sub
Dim mblChange As Boolean
Dim mrc As ADODB.Recordset
Public txtSQL As String
Private Sub cmdSave_Click()
Dim intCount As Integer
Dim sMeg As String
Dim MsgText As String
For intCount = 0 To 4
If Trim(txtItem(intCount) & " ") = " " Then
Select Case intCount
Case 0
sMeg = "标准编号"
Case 1
sMeg = "标准名称"
Case 2
sMeg = "房间面积"
Case 3
sMeg = "订位数量"
Case 4
sMeg = "床位单价"
End Select
sMeg = sMeg & "不能为空!"
MsgBox sMeg, vbOKOnly + vbExclamation, "警告"
txtItem(intCount).SetFocus
Exit Sub
End If
Next intCount
For intCount = 2 To 4
If Not IsNumeric(Trim(txtItem(intCount))) Then
Select Case intCount
Case 2
sMeg = "房间面积"
Case 3
sMeg = "床位数量"
Case 4
sMeg = "床位单价"
End Select
sMeg = sMeg & "请输入数字!"
MsgBox sMeg, vbOKOnly + vbExclamation, "警告"
txtItem(intCount).SetFocus
Exit Sub
End If
Next intCount
If gintTmode = 1 Then
txtSQL = "select * from roomtype where typeid='" & Trim(txtItem(0)) & "" '
Set mrc = ExecuteSQL(txtSQL, MsgText)
If mrc.EOF = False Then
MsgBox "已经存在此标准编号的记录!", vbOKOnly + vbExclamation, "警告"
txtItem(0).SetFocus
Exit Sub
End If
mrc.Close
End If
txtSQL = "select * from roomtype where typeid<>'" & Trim(txtItem(0)) & "'and typename='" & Trim(txtItem(1)) & "'"
Set mrc = ExecuteSQL(txtSQL, MsgText)
If mrc.EOF = False Then
MsgBox "已经存在相同物资内容的记录!", vbOKOnly + vbExclamation, "警告"
txtItem(1).SetFoucs
Exit Sub
End If
txtSQL = "delect from roomtype where typeid='" & Trim(txtItem(0)) & "'"
Set mrc = ExecuteSQL(txtSQL, MsgText)
mrc.AddNew
For intCount = 0 To 3
mrc.Fields(intCount) = Trim(txtItem(intCount))
Next intCount
For intCount = 0 To 3
mrc.Fields(intCount + 4) = Trim(Combo1(intCount))
Next intCount
mrc.Fields(8) = Trim(txtItem(4))
mrc.Update
mrc.Close
If gintTmode = 1 Then
MsgBox "添加记录成功!", vbOKOnly + vbExclamation, "添加记录"
For intCount = 0 To 4
txtTtem(intCount) = " "
Next intCount
For intCount = 0 To 3
Combo1(intCount).ListIndex = 0
Next intCount
mblChange = Flase
If flagTedit Then
Unload firRoomtype
frmRoomtype.txtSQL = "select * from roomtype"
frmRoomtype.Show
End If
ElseIf gintTmode = 2 Then
Unload Me
If flagTedit Then
Unload frmRoomtype
End If
frmRoomtype.txtSQL = "select * from roomtype"
frmRoomtype.Show
End If
End Sub
Private Sub Form_Load()
Dim intCount As Integer
Dim MsgText As String
Dim i As Integer
If gintTmode = 1 Then
Me.Caption = Me.Caption & " 添加"
For i = 0 To 3
Combo1(i).AddItem "否"
Combo1(i).AddItem "是"
Combo1(i).ListIndex = 0
Next i
ElseIf gintTmode = 2 Then
Set mrc = ExecuteSQL(txtSQL, MsgText)
If mrc.EOF = Flase Then
whith mrc
For intCount = 0 To 3
txtItem(intCount) = .fileds(intCount)
Next intCount
textItem(4) = .Fields(8)
For i = 0 To 3
Combo1(i).AddItem "否"
Combo1(i).AddItem "是"
If .Fields(4 + i).Value = "否" Then
Combo1(i).ListIndex = 0
Else
Combo1(i).ListIndex = 1
End If
Next i
End With
txtItem(0).Enabled = False
End If
Me.Caption = Me.Caption & "修改"
End If
mblChange = Flase
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -