⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 main_kfgl.frm

📁 酒店客房管理系统(vb^+SQLServer2000+使用说明)
💻 FRM
📖 第 1 页 / 共 2 页
字号:
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   375
         Left            =   60
         TabIndex        =   17
         Top             =   1155
         Width           =   1110
      End
      Begin VB.Label Label1 
         BackStyle       =   0  'Transparent
         Caption         =   "房间号          房   态    "
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   795
         Left            =   90
         TabIndex        =   13
         Top             =   255
         Width           =   975
      End
      Begin VB.Label Label2 
         BackStyle       =   0  'Transparent
         Caption         =   "房间类型          价    格"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   780
         Left            =   4335
         TabIndex        =   12
         Top             =   210
         Width           =   1110
      End
      Begin VB.Label Label3 
         BackStyle       =   0  'Transparent
         Caption         =   "配   置         备   注:                 "
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   795
         Left            =   120
         TabIndex        =   11
         Top             =   1605
         Width           =   975
      End
      Begin VB.Label Label6 
         BackStyle       =   0  'Transparent
         Caption         =   "使用设备"
         BeginProperty Font 
            Name            =   "宋体"
            Size            =   12
            Charset         =   134
            Weight          =   400
            Underline       =   0   'False
            Italic          =   0   'False
            Strikethrough   =   0   'False
         EndProperty
         Height          =   420
         Left            =   4320
         TabIndex        =   10
         Top             =   1155
         Width           =   1080
      End
   End
   Begin VB.CommandButton Comend 
      Caption         =   "退出"
      Height          =   345
      Left            =   7275
      MaskColor       =   &H8000000F&
      Style           =   1  'Graphical
      TabIndex        =   1
      Top             =   4440
      Width           =   1155
   End
   Begin VB.CommandButton Comcancel 
      Caption         =   "取消"
      Height          =   330
      Left            =   5985
      MaskColor       =   &H8000000F&
      Style           =   1  'Graphical
      TabIndex        =   0
      Top             =   4440
      Width           =   1155
   End
End
Attribute VB_Name = "main_kfgl"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim rs1 As New ADODB.Recordset

Private Sub Form_Load()
    '自动识别数据库路径
    Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\DB_KFGL.mdb;Persist Security Info=False"
    Adodc1.RecordSource = "select * from tb_kf"
    Adodc1.Refresh
    Set DataGrid1.DataSource = Adodc1
    DataGrid1.Columns(4).Width = 0
    Texfjh.Enabled = False
    Combo1.Enabled = False
    Combo2.Enabled = False
    Texjg.Enabled = False
    DTP1.Enabled = False
    Texsz.Enabled = False
    Texpz.Enabled = False
    Texbz.Enabled = False
End Sub
Private Sub Form_Unload(Cancel As Integer)
 Main.Enabled = True
End Sub
Private Sub Combo1_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = vbKeyReturn Then Combo2.SetFocus  '按回车键Combo2获得焦点
    '查询客房信息
    Adodc1.RecordSource = "select * from tb_kf where 房间类型='" + Combo1.text + "'"
    Adodc1.Refresh
    If Adodc1.Recordset.RecordCount > 0 Then Texjg.text = Adodc1.Recordset.Fields("价格")
End Sub
Private Sub texfjh_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = vbKeyReturn Then Combo1.SetFocus     '按回车键Combo1获得焦点
End Sub
Private Sub Combo2_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = vbKeyReturn Then Texjg.SetFocus   '按回车键Texjg获得焦点
End Sub
Private Sub texjg_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = vbKeyReturn Then DTP1.SetFocus   '按回车键DTP1获得焦点
End Sub
Private Sub DTP1_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = vbKeyReturn Then Texsz.SetFocus     '按回车键Texsz获得焦点
End Sub
Private Sub texsz_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = vbKeyReturn Then Texpz.SetFocus  '按回车键Texpz获得焦点
End Sub
Private Sub texpz_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = vbKeyReturn Then Texbz.SetFocus    '按回车键Texbz获得焦点
End Sub
Private Sub texbz_KeyDown(KeyCode As Integer, Shift As Integer)
    If KeyCode = vbKeyReturn Then Comsave.SetFocus   '按回车键Comsave获得焦点
End Sub
Private Sub comdj_Click()    '登记
    Texfjh.Enabled = True
    Combo1.Enabled = True
    Combo2.Enabled = True
    Texjg.Enabled = True
    DTP1.Enabled = True
    Texsz.Enabled = True
    Texpz.Enabled = True
    Texbz.Enabled = True
    Texfjh.text = "": Texjg.text = "": Texsz.text = ""
    Texpz.text = "": Texbz.text = ""
    Comsave.Enabled = True: Comcancel.Enabled = True: Comdj.Enabled = False
    Texfjh.SetFocus
End Sub
Private Sub comsave_Click()
    '查找客房信息
    Adodc1.RecordSource = "select * from tb_kf  where 房间号='" & Trim(Texfjh.text) & "'"
    Adodc1.Refresh
    If Adodc1.Recordset.RecordCount > 0 Then  '如果记录数大于零
        If Adodc1.Recordset.Fields("房态") = "入住" Then
            MsgBox "该房间正在使用,请客人退房后再修改信息"
            Exit Sub
        End If
        If MsgBox("该客房已存在,确认修改客房信息", 4) = vbYes Then

            If Texfjh.text <> "" Then Adodc1.Recordset.Fields("房间号") = Texfjh.text
            If Combo2.text <> "" Then Adodc1.Recordset.Fields("房态") = Combo2.text
            If Combo1.text <> "" Then Adodc1.Recordset.Fields("房间类型") = Combo1.text
            If Texjg.text <> "" Then Adodc1.Recordset.Fields("价格") = Texjg.text
            Adodc1.Recordset.Fields("使用设置") = Texsz.text
            Adodc1.Recordset.Fields("配置") = Texpz.text
            Adodc1.Recordset.Fields("备注") = Texbz.text
            Adodc1.Recordset.Fields("标志") = "0"
            Adodc1.Recordset.Update
        End If
    Else
      If MsgBox("添加新房间?", 4) = vbYes Then
  adocon.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\DB_KFGL.mdb;Persist Security Info=False"
   adoRs.Open "select * from tb_kf", adocon, adOpenKeyset, adLockOptimistic
   adoRs.AddNew
   adoRs.Fields("房间号") = Texfjh.text
   adoRs.Fields("房间类型") = Combo1.text
   adoRs.Fields("房态") = Combo2.text
   adoRs.Fields("价格") = Texjg.text
   adoRs.Fields("营业日期") = DTP1.Value
   adoRs.Fields("使用设置") = Texsz.text
   adoRs.Fields("配置") = Texpz.text
   adoRs.Fields("备注") = Texbz.text
   adoRs.Fields("标志") = "0"
   adoRs.Update     '更新记录
   adocon.Close
   End If
 End If
    Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\DB_KFGL.mdb;Persist Security Info=False"
    Adodc1.RecordSource = "select * from tb_kf"
    Adodc1.Refresh
    Set DataGrid1.DataSource = Adodc1

'     Unload Me
'    main_kfgl.Show
    '设置控件有效或无效
    Comsave.Enabled = False: Comcancel.Enabled = False
    Comend.Enabled = True: Comdj.Enabled = True
End Sub
Private Sub comcancel_Click()     '取消操作
 Texfjh.text = "": Texjg.text = "": Texsz.text = ""
 Texpz.text = "": Texbz.text = ""
 Comsave.Enabled = False: Comcancel.Enabled = False: Comdj.Enabled = True
End Sub
Private Sub comend_Click()
 Main.Enabled = True
 Unload Me
End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -