📄 main_mima.frm
字号:
VERSION 5.00
Object = "{FAEEE763-117E-101B-8933-08002B2F4F5A}#1.1#0"; "DBLIST32.OCX"
Begin VB.Form main_mima
BackColor = &H00C0C0C0&
BorderStyle = 1 'Fixed Single
Caption = "宾馆客房管理系统"
ClientHeight = 2700
ClientLeft = 45
ClientTop = 330
ClientWidth = 5490
Icon = "main_mima.frx":0000
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 2700
ScaleWidth = 5490
StartUpPosition = 1 '所有者中心
Begin VB.Frame Frame1
Height = 1215
Left = 2160
TabIndex = 3
Top = 705
Width = 3105
Begin VB.TextBox Text2
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 315
IMEMode = 3 'DISABLE
Left = 1005
MaxLength = 6
PasswordChar = "*"
TabIndex = 5
Top = 705
Width = 1920
End
Begin MSDBCtls.DBCombo text1
Bindings = "main_mima.frx":000C
Height = 330
Left = 1005
TabIndex = 4
Top = 210
Width = 1920
_ExtentX = 3387
_ExtentY = 582
_Version = 393216
ListField = "操作员"
Text = ""
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 = 405
Left = 120
TabIndex = 7
Top = 255
Width = 1095
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 = 300
Left = 120
TabIndex = 6
Top = 735
Width = 975
End
End
Begin VB.Data Data1
Caption = "Data1"
Connect = "Access"
DatabaseName = "D:\VB数据库开发实例解析\程序\宾馆客房管理系统\Kfgl.mdb"
DefaultCursorType= 0 '缺省游标
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 345
Left = -765
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = "qxsz"
Top = -165
Visible = 0 'False
Width = 1110
End
Begin VB.Data Data2
Caption = "Data1"
Connect = "Access"
DatabaseName = "D:\VB数据库开发实例解析\程序\宾馆客房管理系统\Kfgl.mdb"
DefaultCursorType= 0 '缺省游标
DefaultType = 2 '使用 ODBC
Exclusive = 0 'False
Height = 345
Left = -840
Options = 0
ReadOnly = 0 'False
RecordsetType = 1 'Dynaset
RecordSource = "qxsz"
Top = 60
Visible = 0 'False
Width = 1140
End
Begin VB.CommandButton Cmd2
BackColor = &H00FF8080&
Caption = "退出"
Height = 400
Left = 3720
TabIndex = 1
Top = 2145
Width = 1365
End
Begin VB.CommandButton Cmd1
BackColor = &H00FF8080&
Caption = "确定"
Height = 400
Left = 2355
TabIndex = 0
Top = 2145
UseMaskColor = -1 'True
Width = 1365
End
Begin VB.Shape Shape1
Height = 1830
Left = 150
Top = 705
Width = 1830
End
Begin VB.Image Image1
Height = 1800
Left = 150
Picture = "main_mima.frx":0020
Stretch = -1 'True
Top = 720
Width = 1830
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "宾馆客房管理系统"
BeginProperty Font
Name = "方正行楷简体"
Size = 21.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 420
Left = 1005
TabIndex = 2
Top = 120
Width = 3600
End
Begin VB.Label Label4
BackStyle = 0 'Transparent
Caption = "宾馆客房管理系统"
BeginProperty Font
Name = "方正行楷简体"
Size = 21.75
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FFFF80&
Height = 420
Left = 1020
TabIndex = 8
Top = 135
Width = 3600
End
End
Attribute VB_Name = "main_mima"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim TIM As Integer '定义一个整型变量
Dim myval As String '定义一个字符串变量
Private Sub Form_Load()
'自动识别数据库路径
Data1.DatabaseName = App.Path & "\KFGL.mdb"
Data2.DatabaseName = App.Path & "\KFGL.mdb"
End Sub
Private Sub Form_Activate()
'当记录为零时,进入系统具有所有权限
If Data1.Recordset.RecordCount = 0 Then
MsgBox ("请先设置操作员密码和权限!")
Load main
main.Show
Unload Me
Else
Text1.SetFocus
End If
End Sub
Private Sub Text1_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Text2.SetFocus '按回车键,text2获得焦点
End Sub
Private Sub text2_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = vbKeyReturn Then Cmd1.SetFocus '按回车键cmd1获得焦点
If KeyCode = vbKeyUp Then Text1.SetFocus
If KeyCode = vbKeyDown Then Cmd1.SetFocus
End Sub
Private Sub cmd1_Click()
main.StatusBar1.Panels(4).Text = Text1.Text '赋值给main.StatusBar1.Panels(4).Text
'验证操作员及密码
If Data2.Recordset.BOF = False Then Data2.Recordset.MoveFirst
Data2.Recordset.FindFirst "操作员 like " + Chr(34) + Text1.BoundText + Chr(34) + ""
If Data2.Recordset.NoMatch Then
MsgBox ("操作员输入错误!")
Else
Data1.RecordSource = "select * from qxsz where 操作员='" & Text1.BoundText & "'"
Data1.Refresh
If Text1.BoundText <> "" And Text2.Text <> "" And Text2.Text = Data1.Recordset.Fields("密码") Then
Load main
main.Show
Unload Me
Else
If TIM = 3 Then '密码输错3次,退出系统
myval = MsgBox("密码输入错误,请向系统管理员查询!", 0, "")
If myval = vbOK Then End
End If
If Text1.BoundText = "" Then
MsgBox ("请输入操作员!")
Text1.SetFocus
Else
If Text1.BoundText <> Data1.Recordset.Fields("操作员") Then
MsgBox ("查无此操作员,请重新输入操作员!")
Text1.SetFocus
Else
If Text2.Text = "" Then
MsgBox ("请输入操作员密码!")
Text2.SetFocus
Else
If Text2.Text <> Data1.Recordset.Fields("密码") Then
MsgBox ("密码错误,请重新输入密码!")
TIM = TIM + 1
Text2.SetFocus
End If
End If
End If
End If
End If
End If
End Sub
Private Sub cmd2_Click()
End
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -