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

📄 frmregister.frm

📁 An application on Hotel Management System. I developed it for my project during exam time. Any how i
💻 FRM
📖 第 1 页 / 共 2 页
字号:
      EndProperty
      Height          =   375
      Left            =   480
      TabIndex        =   14
      Top             =   4320
      Width           =   2055
   End
   Begin VB.Label Label5 
      BackStyle       =   0  'Transparent
      Caption         =   "Customer No."
      BeginProperty Font 
         Name            =   "Times New Roman"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   480
      TabIndex        =   13
      Top             =   840
      Width           =   1455
   End
   Begin VB.Label Label4 
      BackStyle       =   0  'Transparent
      Caption         =   "Email"
      BeginProperty Font 
         Name            =   "Times New Roman"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   2640
      TabIndex        =   12
      Top             =   3240
      Width           =   975
   End
   Begin VB.Label Label3 
      BackStyle       =   0  'Transparent
      Caption         =   "Telephone"
      BeginProperty Font 
         Name            =   "Times New Roman"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   480
      TabIndex        =   11
      Top             =   3240
      Width           =   1335
   End
   Begin VB.Label Label2 
      BackStyle       =   0  'Transparent
      Caption         =   "Address"
      BeginProperty Font 
         Name            =   "Times New Roman"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   480
      TabIndex        =   10
      Top             =   1680
      Width           =   1575
   End
   Begin VB.Label Label1 
      BackStyle       =   0  'Transparent
      Caption         =   "Name"
      BeginProperty Font 
         Name            =   "Times New Roman"
         Size            =   12
         Charset         =   0
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   2520
      TabIndex        =   9
      Top             =   840
      Width           =   975
   End
End
Attribute VB_Name = "FrmRegister"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim MyDb As Database, MyRs As Recordset
Dim Db As Database, Rs As Recordset
Dim FS, SL
Const Reading = 1, Writing = 2

Private Sub Command1_Click()
Set MyDb = DBEngine.Workspaces(0).OpenDatabase("D:\HOTEL\CUSTOMER\CUSTOMER.MDB")
Set MyRs = MyDb.OpenRecordset("customer", dbOpenDynaset)
MyRs.AddNew
     MyRs!ID = "NO"
     MyRs!SL = Text1.Text
     MyRs!Name = Text2.Text
     MyRs!ADDRESS = Text3.Text
     MyRs!TEL = Text4.Text
     MyRs!EMAIL = Text5.Text
     MyRs!REGEXPIRY = Text7.Text
     MyRs!ARRIVAL = Text7.Text
     MyRs!REGDATE = Text6.Text
     MyRs!TYPEOFROOM = Text8.Text
     MyRs!NOOFDAYS = Text9.Text
MyRs.Update
Open "D:\HOTEL\CUSTOMERNO.TXT" For Output As #3
     Print #3, Text1.Text
     Close #3
MyDb.Close
     Text1.Text = ""
     Text2.Text = ""
     Text3.Text = ""
     Text4.Text = ""
     Text5.Text = ""
     Text7.Text = ""
     Text7.Text = ""
     Text6.Text = ""
     Text8.Text = ""
     Text9.Text = ""
     
     
Form_Load
Text2.SetFocus

End Sub

Private Sub Command2_Click()
MyRs.Edit
     MyRs!SL = Text1.Text
     MyRs!Name = Text2.Text
     MyRs!ADDRESS = Text3.Text
     MyRs!TEL = Text4.Text
     MyRs!EMAIL = Text5.Text
     MyRs!REGEXPIRY = Text7.Text
     MyRs!ARRIVAL = Text7.Text
     MyRs!REGDATE = Text6.Text
     MyRs!TYPEOFROOM = Text8.Text
     MyRs!NOOFDAYS = Text9.Text
MyRs.Update
MsgBox "Registration Record is Edited", vbOKOnly + vbInformation
MyDb.Close
     Text1.Text = ""
     Text2.Text = ""
     Text3.Text = ""
     Text4.Text = ""
     Text5.Text = ""
     Text7.Text = ""
     Text7.Text = ""
     Text6.Text = ""
     Text8.Text = ""
     Text9.Text = ""
Form_Load
Text2.SetFocus
End Sub

Private Sub Command3_Click()
res = MsgBox("Are you sure that you want to delete the Registered Customer Record.", vbYesNo + vbQuestion)
If res = vbYes Then
MyRs.Delete
Command5_Click
Form_Load
                                        'MsgBox "The Record of Registered Customer is Deleted", vbOKOnly + vbInformation
Else
Exit Sub
End If

End Sub

Private Sub Command4_Click()

Unload Me

End Sub

Private Sub Command5_Click()
     Text1.Text = ""
     Text2.Text = ""
     Text3.Text = ""
     Text4.Text = ""
     Text5.Text = ""
     Text8.Text = ""
     Text9.Text = ""
     Text1.Text = Val(Text17.Text) + 1
     Text1.Text = Format(Text1.Text, "000000")
     Text2.SetFocus
End Sub

Private Sub Command6_Click()
FrmConferm.Show
Unload Me
End Sub

Private Sub Form_Load()
On Error Resume Next
Me.Left = MDIForm1.Left + 1000
Me.Top = MDIForm1.Top + 1000
Dim D
List1.Clear
List2.Clear
D = Format(Now, "dd/mm/yy")

Set FS = CreateObject("Scripting.FileSystemObject")
Set SL = FS.OpenTextFile("D:\HOTEL\CUSTOMERNO.TXT", Reading)
Text17.Text = SL.READALL
SL.Close
Text1.Text = Val(Text17.Text) + 1
Text1.Text = Format(Text1.Text, "000000")

Text6.Text = D
Text7.Text = D

SQL = "select distinct typeofroom from ROOMS"
Set Db = DBEngine.Workspaces(0).OpenDatabase("D:\HOTEL\ROOMS\ROOMS.MDB")
Set Rs = Db.OpenRecordset(SQL, dbOpenDynaset)
If Rs.RecordCount <= 0 Then
Exit Sub
Else
   Do While Not Rs.EOF
      List1.AddItem Rs!TYPEOFROOM
    Rs.MoveNext
    Loop
End If

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

SQL = "select * from CUSTOMER where ID='" & "NO" & "'"
Set MyDb = DBEngine.Workspaces(0).OpenDatabase("D:\HOTEL\CUSTOMER\CUSTOMER.MDB")
Set MyRs = MyDb.OpenRecordset(SQL, dbOpenDynaset)

If MyRs.RecordCount <= 0 Then
Exit Sub
Else
   Do While Not MyRs.EOF
      List2.AddItem MyRs!SL
    MyRs.MoveNext
    Loop
End If

End Sub

Private Sub List1_DblClick()
Text8.Text = List1.Text
List1.Visible = False
Text9.SetFocus
End Sub

Private Sub List1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
 Text8.Text = List1.Text
 Text9.SetFocus
 List1.Visible = False
 End If
 
End Sub

Private Sub List2_Click()
SQL = "select * from CUSTOMER where SL='" & List2.Text & "'"
Set MyDb = DBEngine.Workspaces(0).OpenDatabase("D:\HOTEL\CUSTOMER\CUSTOMER.MDB")
Set MyRs = MyDb.OpenRecordset(SQL, dbOpenDynaset)
   Text1.Text = MyRs!SL
   Text3.Text = MyRs!ADDRESS
   Text2.Text = MyRs!Name
   Text4.Text = MyRs!TEL
   Text5.Text = MyRs!EMAIL
   Text6.Text = MyRs!REGDATE
   Text7.Text = MyRs!ARRIVAL
   Text8.Text = MyRs!TYPEOFROOM
   Text9.Text = MyRs!NOOFDAYS
   
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
 End If
End Sub
Private Sub Text4_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
    Text5.SetFocus
 End If
End Sub
Private Sub Text5_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
    Text6.SetFocus
 End If
End Sub
Private Sub Text6_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
    Text7.SetFocus
 End If
End Sub
Private Sub Text7_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
    List1.Visible = True
    List1.SetFocus
    If List1.ListCount = 0 Then
    Exit Sub
    Else
    List1.ListIndex = 0
    End If
  End If
End Sub

Private Sub Text8_Click()
List1.Visible = True
End Sub

Private Sub Text8_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
    Text9.SetFocus
 End If
End Sub
Private Sub Text9_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then
   Command1_Click
 End If
End Sub

⌨️ 快捷键说明

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