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

📄 frmroomentry.frm

📁 An application on Hotel Management System. I developed it for my project during exam time. Any how i
💻 FRM
字号:
VERSION 5.00
Begin VB.Form FrmRoomEntry 
   BackColor       =   &H00C0E0FF&
   BorderStyle     =   0  'None
   Caption         =   "New Room Entry"
   ClientHeight    =   5895
   ClientLeft      =   0
   ClientTop       =   0
   ClientWidth     =   6225
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   5895
   ScaleWidth      =   6225
   ShowInTaskbar   =   0   'False
   Begin VB.CommandButton Command4 
      BackColor       =   &H00808080&
      Caption         =   "Delete Room Record"
      Enabled         =   0   'False
      BeginProperty Font 
         Name            =   "Times New Roman"
         Size            =   14.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   2520
      Style           =   1  'Graphical
      TabIndex        =   14
      Top             =   4440
      Width           =   3255
   End
   Begin VB.CommandButton Command3 
      BackColor       =   &H00808080&
      Caption         =   "Edit Room Record"
      Enabled         =   0   'False
      BeginProperty Font 
         Name            =   "Times New Roman"
         Size            =   14.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   2520
      Style           =   1  'Graphical
      TabIndex        =   12
      Top             =   3960
      Width           =   3255
   End
   Begin VB.TextBox Text4 
      Appearance      =   0  'Flat
      Height          =   405
      Left            =   3480
      TabIndex        =   3
      Top             =   2760
      Width           =   2295
   End
   Begin VB.TextBox Text3 
      Appearance      =   0  'Flat
      Height          =   375
      Left            =   3480
      TabIndex        =   2
      Top             =   2160
      Width           =   2295
   End
   Begin VB.TextBox Text1 
      Appearance      =   0  'Flat
      Height          =   405
      Left            =   3480
      TabIndex        =   0
      Top             =   960
      Width           =   2295
   End
   Begin VB.TextBox Text2 
      Appearance      =   0  'Flat
      Height          =   375
      Left            =   3480
      TabIndex        =   1
      Top             =   1560
      Width           =   2295
   End
   Begin VB.ListBox List1 
      Appearance      =   0  'Flat
      Height          =   4320
      Left            =   240
      Sorted          =   -1  'True
      TabIndex        =   6
      Top             =   960
      Width           =   1695
   End
   Begin VB.CommandButton Command1 
      BackColor       =   &H00808080&
      Caption         =   "Update Room"
      Enabled         =   0   'False
      BeginProperty Font 
         Name            =   "Times New Roman"
         Size            =   14.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   2520
      Style           =   1  'Graphical
      TabIndex        =   4
      Top             =   3480
      Width           =   3255
   End
   Begin VB.CommandButton Command2 
      BackColor       =   &H00808080&
      Caption         =   "Quit"
      BeginProperty Font 
         Name            =   "Times New Roman"
         Size            =   14.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   2520
      Style           =   1  'Graphical
      TabIndex        =   5
      Top             =   4920
      Width           =   3255
   End
   Begin VB.Label Label1 
      BackStyle       =   0  'Transparent
      Caption         =   "New Room Entry"
      BeginProperty Font 
         Name            =   "Times New Roman"
         Size            =   21.75
         Charset         =   0
         Weight          =   700
         Underline       =   -1  'True
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H000000FF&
      Height          =   495
      Index           =   3
      Left            =   240
      TabIndex        =   13
      Top             =   120
      Width           =   4095
   End
   Begin VB.Label Label1 
      BackStyle       =   0  'Transparent
      Caption         =   "Type of Room"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Index           =   2
      Left            =   2160
      TabIndex        =   11
      Top             =   2160
      Width           =   1215
   End
   Begin VB.Label Label3 
      BackStyle       =   0  'Transparent
      Caption         =   "Features"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   2160
      TabIndex        =   10
      Top             =   2760
      Width           =   975
   End
   Begin VB.Label Label1 
      BackStyle       =   0  'Transparent
      Caption         =   "Room No."
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Index           =   0
      Left            =   2160
      TabIndex        =   9
      Top             =   960
      Width           =   1215
   End
   Begin VB.Label Label2 
      BackStyle       =   0  'Transparent
      Caption         =   "Room Charges"
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Left            =   2160
      TabIndex        =   8
      Top             =   1560
      Width           =   1455
   End
   Begin VB.Label Label1 
      BackStyle       =   0  'Transparent
      Caption         =   "Room No."
      BeginProperty Font 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   255
      Index           =   1
      Left            =   240
      TabIndex        =   7
      Top             =   720
      Width           =   975
   End
End
Attribute VB_Name = "FrmRoomEntry"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim MyDb As Database, MyRs As Recordset

Private Sub Command1_Click()
Set MyDb = DBEngine.Workspaces(0).OpenDatabase("D:\HOTEL\ROOMS\ROOMS.MDB")
Set MyRs = MyDb.OpenRecordset("ROOMS", dbOpenDynaset)
MyRs.AddNew
    MyRs!ROOMNO = Text1.Text
    MyRs!TYPEOFROOM = Text3.Text
    MyRs!Rate = Text2.Text
    MyRs!FEATURS = Text4.Text
    MyRs!Status = "EMPTY"
 MyRs.Update
 MsgBox "RECORD OF ROOM IS UPDATED", vbOKOnly, "Hotel Management System"
 Text1 = ""
 Text2 = ""
 Text3 = ""
 Text4 = ""
 Form_Load
 
End Sub

Private Sub Command2_Click()
 
 Unload Me
 
End Sub

Private Sub Command3_Click()

MyRs.Edit
    MyRs!ROOMNO = Text1.Text
    MyRs!TYPEOFROOM = Text3.Text
    MyRs!Rate = Text2.Text
    MyRs!FEATURS = Text4.Text
 MyRs.Update
 MyRs.Close
 MyDb.Close
 MsgBox "RECORD OF ROOM IS UPDATED", vbOKOnly, "Hotel Management System"
 Text1 = ""
 Text2 = ""
 Text3 = ""
 Text4 = ""
 Command3.Enabled = False
 Form_Load
End Sub

Private Sub Command4_Click()
ans = MsgBox("Do you want to Delete Room No. " & List1.Text, vbQuestion + vbYesNo, "Hotel Management System")
If ans = vbYes Then
MyRs.Delete
MsgBox "Room No. " & List1.Text & " has been deleted.", vbOKOnly, "Hotel Management System"
Text1 = ""
 Text2 = ""
 Text3 = ""
 Text4 = ""
 Form_Load
 Else
 Exit Sub
 End If
 
End Sub

Private Sub Form_Load()
Me.Left = MDIForm1.Left + 1000
Me.Top = MDIForm1.Top + 1000

List1.Clear

Set MyDb = DBEngine.Workspaces(0).OpenDatabase("D:\HOTEL\ROOMS\ROOMS.MDB")
Set MyRs = MyDb.OpenRecordset("ROOMS", dbOpenDynaset)
If MyRs.RecordCount <= 0 Then
Exit Sub
Else
   Do While Not MyRs.EOF
      List1.AddItem MyRs!ROOMNO
    MyRs.MoveNext
    Loop
End If
MyDb.Close

End Sub

Private Sub List1_Click()
Command3.Enabled = True
Command4.Enabled = True
SQL = "select * from rooms where roomno='" & List1.Text & "'"

Set MyDb = DBEngine.Workspaces(0).OpenDatabase("D:\HOTEL\ROOMS\ROOMS.MDB")
'Set MyRs = MyDb.OpenRecordset("ROOMS", dbOpenDynaset)
Set MyRs = MyDb.OpenRecordset(SQL, dbOpenDynaset)

   Text1.Text = MyRs!ROOMNO
   Text3.Text = MyRs!TYPEOFROOM
   Text2.Text = MyRs!Rate
   Text4.Text = MyRs!FEATURS

End Sub

Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
  Text2.SetFocus
End If
End Sub
Private Sub Text2_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
  Text3.SetFocus
End If
End Sub
Private Sub Text3_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
  Text4.SetFocus
  Command1.Enabled = True
End If
End Sub

Private Sub Text4_Click()
Command1.Enabled = True
End Sub

Private Sub Text4_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
  Command1.Enabled = True
  Command1_Click
  Command1.Enabled = False
  Text1.SetFocus
End If
End Sub

⌨️ 快捷键说明

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