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

📄 operator.frm

📁 tourist管理系统
💻 FRM
字号:
VERSION 5.00
Object = "{C932BA88-4374-101B-A56C-00AA003668DC}#1.1#0"; "MSMASK32.OCX"
Begin VB.Form OPERATOR 
   BackColor       =   &H00FFC0C0&
   Caption         =   "职员"
   ClientHeight    =   5745
   ClientLeft      =   60
   ClientTop       =   450
   ClientWidth     =   7110
   BeginProperty Font 
      Name            =   "宋体"
      Size            =   12
      Charset         =   134
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   LinkTopic       =   "Form1"
   MDIChild        =   -1  'True
   Picture         =   "OPERATOR.frx":0000
   ScaleHeight     =   5745
   ScaleWidth      =   7110
   Begin VB.Frame Frame1 
      Appearance      =   0  'Flat
      BackColor       =   &H80000005&
      Caption         =   "查询"
      ForeColor       =   &H80000008&
      Height          =   1455
      Left            =   480
      TabIndex        =   23
      Top             =   3600
      Width           =   4335
      Begin VB.ComboBox FindCombo 
         Height          =   360
         ItemData        =   "OPERATOR.frx":3098C
         Left            =   120
         List            =   "OPERATOR.frx":30996
         TabIndex        =   26
         Text            =   "查找"
         Top             =   360
         Width           =   1215
      End
      Begin VB.TextBox Findtxt 
         Height          =   375
         Left            =   1440
         TabIndex        =   25
         Top             =   360
         Width           =   2775
      End
      Begin VB.CommandButton cmdFindOK 
         Caption         =   "查询确认"
         Height          =   375
         Left            =   120
         TabIndex        =   24
         Top             =   960
         Width           =   1215
      End
   End
   Begin VB.TextBox oper_nmtxt 
      Height          =   375
      Left            =   1080
      TabIndex        =   14
      Top             =   720
      Width           =   1935
   End
   Begin VB.TextBox oper_addtxt 
      Height          =   375
      Left            =   4080
      TabIndex        =   13
      Top             =   720
      Width           =   2895
   End
   Begin VB.TextBox oper_telnotxt 
      Height          =   375
      Left            =   1080
      TabIndex        =   12
      Top             =   1320
      Width           =   1455
   End
   Begin VB.TextBox oper_faxnotxt 
      Height          =   375
      Left            =   4080
      TabIndex        =   11
      Top             =   1320
      Width           =   1455
   End
   Begin VB.TextBox oper_emailtxt 
      Height          =   375
      Left            =   1080
      TabIndex        =   10
      Top             =   1920
      Width           =   2895
   End
   Begin VB.ComboBox sexCombo 
      Height          =   360
      ItemData        =   "OPERATOR.frx":309A8
      Left            =   4920
      List            =   "OPERATOR.frx":309B2
      TabIndex        =   9
      Text            =   "BOY"
      Top             =   1920
      Width           =   1095
   End
   Begin VB.CommandButton cmdFirst 
      Caption         =   "<<"
      Height          =   375
      Left            =   480
      TabIndex        =   8
      Top             =   2520
      Width           =   1095
   End
   Begin VB.CommandButton cmdPreviouse 
      Caption         =   "<"
      Height          =   375
      Left            =   1800
      TabIndex        =   7
      Top             =   2520
      Width           =   1095
   End
   Begin VB.CommandButton cmdNext 
      Caption         =   ">"
      Height          =   375
      Left            =   3120
      TabIndex        =   6
      Top             =   2520
      Width           =   1095
   End
   Begin VB.CommandButton cmdLast 
      Caption         =   ">>"
      Height          =   375
      Left            =   4440
      TabIndex        =   5
      Top             =   2520
      Width           =   1095
   End
   Begin VB.CommandButton cmdAdd 
      Caption         =   "添加"
      Height          =   375
      Left            =   480
      TabIndex        =   4
      Top             =   3120
      Visible         =   0   'False
      Width           =   1095
   End
   Begin VB.CommandButton cmdSave 
      Caption         =   "保存"
      Height          =   375
      Left            =   1800
      TabIndex        =   3
      Top             =   3120
      Width           =   1095
   End
   Begin VB.CommandButton cmdCancel 
      Caption         =   "取消"
      Height          =   375
      Left            =   3120
      TabIndex        =   2
      Top             =   3120
      Width           =   1095
   End
   Begin VB.CommandButton cmdExit 
      BackColor       =   &H00FFFFFF&
      Caption         =   "退出"
      Height          =   375
      Left            =   4440
      TabIndex        =   1
      Top             =   3120
      Width           =   1095
   End
   Begin VB.CommandButton cmdUpdata 
      Caption         =   "修改"
      Height          =   375
      Left            =   480
      TabIndex        =   0
      Top             =   3120
      Visible         =   0   'False
      Width           =   1095
   End
   Begin MSMask.MaskEdBox oper_cdMaskEdBox 
      Height          =   375
      Left            =   1080
      TabIndex        =   22
      Top             =   120
      Width           =   1455
      _ExtentX        =   2566
      _ExtentY        =   661
      _Version        =   393216
      MaxLength       =   4
      Mask            =   "C###"
      PromptChar      =   "_"
   End
   Begin VB.Label Label1 
      Alignment       =   1  'Right Justify
      BackColor       =   &H00FFC0C0&
      BackStyle       =   0  'Transparent
      Caption         =   "职员号:"
      Height          =   255
      Left            =   240
      TabIndex        =   21
      Top             =   240
      Width           =   855
   End
   Begin VB.Label Label2 
      Alignment       =   1  'Right Justify
      BackColor       =   &H00FFC0C0&
      BackStyle       =   0  'Transparent
      Caption         =   "姓名:"
      Height          =   255
      Left            =   480
      TabIndex        =   20
      Top             =   840
      Width           =   615
   End
   Begin VB.Label Label3 
      Alignment       =   1  'Right Justify
      BackColor       =   &H00FFC0C0&
      BackStyle       =   0  'Transparent
      Caption         =   "住址:"
      Height          =   255
      Left            =   3480
      TabIndex        =   19
      Top             =   840
      Width           =   615
   End
   Begin VB.Label Label4 
      Alignment       =   1  'Right Justify
      BackColor       =   &H00FFC0C0&
      BackStyle       =   0  'Transparent
      Caption         =   "电话:"
      Height          =   255
      Left            =   480
      TabIndex        =   18
      Top             =   1440
      Width           =   615
   End
   Begin VB.Label Label5 
      Alignment       =   1  'Right Justify
      BackColor       =   &H00FFC0C0&
      BackStyle       =   0  'Transparent
      Caption         =   "传真:"
      Height          =   255
      Left            =   3480
      TabIndex        =   17
      Top             =   1440
      Width           =   615
   End
   Begin VB.Label Label6 
      Alignment       =   1  'Right Justify
      BackColor       =   &H00FFC0C0&
      BackStyle       =   0  'Transparent
      Caption         =   "电子邮件:"
      Height          =   255
      Left            =   0
      TabIndex        =   16
      Top             =   2040
      Width           =   1095
   End
   Begin VB.Label Label7 
      Alignment       =   1  'Right Justify
      BackColor       =   &H00FFC0C0&
      BackStyle       =   0  'Transparent
      Caption         =   "性别:"
      Height          =   255
      Left            =   4320
      TabIndex        =   15
      Top             =   2040
      Width           =   615
   End
End
Attribute VB_Name = "OPERATOR"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim cnn As ADODB.Connection
Dim rs As ADODB.Recordset

Private Sub cmdAdd_Click()
Display_False
oper_cdMaskEdBox.Text = "C___"
oper_nmtxt.Text = ""
oper_addtxt.Text = ""
oper_telnotxt.Text = ""
oper_faxnotxt.Text = ""
oper_emailtxt.Text = ""
sexCombo.Text = "BOY"
End Sub

Private Sub cmdCancel_Click()
rs.Cancel
If cmdAdd.Visible = True Then
rs.MoveFirst
End If
Display
Display_True
FindCombo.Enabled = True
Findtxt.Enabled = True
cmdFindOK.Enabled = True
End Sub

Private Sub cmdExit_Click()
Unload OPERATOR
End Sub

Private Sub cmdFindOK_Click()
Dim str1 As String, str2 As String
Select Case FindCombo.Text
Case Is = "职员号"
str1 = "oper_cd= '" & Trim(Findtxt) & "'"
Case Is = "姓名"
str1 = "oper_nm= '" & Trim(Findtxt) & "'"
Case Else
str2 = "请按" + FindCombo.Text + "类型进行查询!"
MsgBox str2, , "警告"
Exit Sub
End Select
On Error GoTo err
rs.MoveFirst
rs.Find (str1)
If rs.EOF Then
MsgBox "没有查到满足条件的记录"
Else
Display
End If
Exit Sub
err:
MsgBox err.Description
End Sub

Private Sub cmdSave_Click()
If cmdAdd.Visible = True Then
If Len(Trim(oper_cdMaskEdBox)) = 4 And UCase(Left(Trim(oper_cdMaskEdBox), 1)) = "C" And IsNumeric(Right(Trim(oper_cdMaskEdBox), 3)) Then
oper_cdMaskEdBox.Text = UCase(oper_cdMaskEdBox.Text)
Else
MsgBox "C###"
Exit Sub
End If
End If
If cmdAdd.Visible = True Then
If rs.RecordCount > 0 Then
rs.MoveFirst
rs.Find "oper_cd='" & Trim(oper_cdMaskEdBox) & "'"
If rs.EOF = False Then
MsgBox "这个号码已经有了,请另选一个号码!"
oper_cdMaskEdBox.SetFocus
Exit Sub
End If
End If
End If
If oper_nmtxt.Text = Empty Then
MsgBox "姓名不能为空!"
oper_nmtxt.SetFocus
Exit Sub
ElseIf Len(Trim(oper_nmtxt.Text)) > 15 Then
MsgBox "姓名长度不能大于10!"
oper_nmtxt.SetFocus
Exit Sub
End If
If oper_addtxt.Text = Empty Then
MsgBox "地址不能为空!"
oper_addtxt.SetFocus
Exit Sub
ElseIf Len(Trim(oper_addtxt.Text)) > 25 Then
MsgBox "地址长度不能大于25!"
oper_addtxt.SetFocus
Exit Sub
End If
If oper_telnotxt.Text = Empty Then
MsgBox "电话号码不能为空!"
oper_telnotxt.SetFocus
Exit Sub
ElseIf Len(Trim(oper_telnotxt.Text)) > 15 Then
MsgBox "电话号码长度不能大于15!"
oper_telnotxt.SetFocus
Exit Sub
End If
If oper_faxnotxt.Text = Empty Then
MsgBox "传真号码不能为空!"
oper_faxnotxt.SetFocus
Exit Sub
ElseIf Len(Trim(oper_faxnotxt.Text)) > 15 Then
MsgBox "传真号码不能大于15!"
oper_faxnotxt.SetFocus
Exit Sub
End If
If oper_emailtxt.Text = Empty Then
MsgBox "电子邮件不能为空!"
oper_emailtxt.SetFocus
Exit Sub
ElseIf Len(Trim(oper_emailtxt.Text)) > 25 Then
MsgBox "电子邮件长度不能大于25!"
oper_emailtxt.SetFocus
Exit Sub
End If
If sexCombo.Text = Empty Then
MsgBox "性别不能为空!"
sexCombo.SetFocus
Exit Sub
ElseIf sexCombo.Text <> "BOY" And sexCombo.Text <> "GIRL" Then
MsgBox "性别只能为 BOY 或者是 GIRL!"
sexCombo.SetFocus
Exit Sub
End If
If cmdAdd.Visible = True Then
rs.AddNew
End If
rs!oper_cd = oper_cdMaskEdBox.Text
If oper_cdMaskEdBox.Text <> Empty Then rs!oper_cd = oper_cdMaskEdBox.Text
If oper_nmtxt.Text <> Empty Then rs!oper_nm = oper_nmtxt.Text
If oper_addtxt.Text <> Empty Then rs!oper_add = oper_addtxt.Text
If oper_telnotxt.Text <> Empty Then rs!oper_telno = CStr(oper_telnotxt.Text)
If oper_faxnotxt.Text <> Empty Then rs!oper_faxno = CStr(oper_faxnotxt.Text)
If oper_emailtxt.Text <> Empty Then rs!oper_email = oper_emailtxt.Text
rs!sex = sexCombo.Text
rs.Update
MsgBox "保存成功!"
If cmdAdd.Visible = True Then
rs.MoveLast
End If
Display
Display_True
FindCombo.Enabled = True
Findtxt.Enabled = True
cmdFindOK.Enabled = True
End Sub

Private Sub cmdUpdata_Click()
Display_False
oper_cdMaskEdBox.Enabled = False
End Sub

Private Sub FindCombo_Click()
Select Case Trim(FindCombo.Text)
Case Is = "职员号"
Findtxt.Text = "C"
Case Is = "姓名"
Findtxt.Text = ""
Case Else
End Select
End Sub

Private Sub Form_Load()
OPERATOR.WindowState = 2
Set cnn = New ADODB.Connection
cnn.ConnectionString = "FILE NAME=" & App.Path & "\Tourist.udl"
cnn.Open
Set rs = New ADODB.Recordset
rs.CursorLocation = adUseClient
rs.Open "OPERATOR", cnn, adOpenDynamic, adLockOptimistic, adCmdTable
Display
Display_True
FindCombo.Enabled = True
Findtxt.Enabled = True
cmdFindOK.Enabled = True
End Sub

Private Sub Form_Unload(Cancel As Integer)
rs.Close
Set rs = Nothing
cnn.Close
Set cnn = Nothing
End Sub
Private Sub Display()
oper_cdMaskEdBox.Text = rs!oper_cd
oper_nmtxt.Text = rs!oper_nm
oper_addtxt.Text = rs!oper_add
oper_telnotxt.Text = rs!oper_telno
oper_faxnotxt.Text = rs!oper_faxno
oper_emailtxt.Text = rs!oper_email
sexCombo.Text = rs!sex
End Sub
Private Sub Display_False()
Dim ctl As Control
For Each ctl In Controls
If TypeOf ctl Is TextBox Or TypeOf ctl Is ComboBox Or TypeOf ctl Is MaskEdBox Or TypeOf ctl Is CommandButton Then
ctl.Enabled = True
End If
Next ctl
cmdFirst.Enabled = False
cmdPreviouse.Enabled = False
cmdNext.Enabled = False
cmdLast.Enabled = False
cmdAdd.Enabled = False
cmdUpdata.Enabled = False
End Sub
Private Sub Display_True()
Dim ctl As Control
For Each ctl In Controls
If TypeOf ctl Is TextBox Or TypeOf ctl Is ComboBox Or TypeOf ctl Is MaskEdBox Or TypeOf ctl Is CommandButton Then
ctl.Enabled = False
End If
Next ctl
cmdExit.Enabled = True
cmdFirst.Enabled = True
cmdPreviouse.Enabled = True
cmdNext.Enabled = True
cmdLast.Enabled = True
cmdAdd.Enabled = True
cmdUpdata.Enabled = True
End Sub
Private Sub cmdFirst_Click()
rs.MoveFirst
Display
End Sub

Private Sub cmdLast_Click()
rs.MoveLast
Display
End Sub

Private Sub cmdNext_Click()
With rs
.MoveNext
If .EOF Then .MoveLast
End With
Display
End Sub

Private Sub cmdPreviouse_Click()
With rs
.MovePrevious
If .BOF Then .MoveFirst
End With
Display
End Sub

Private Sub oper_faxnotxt_KeyPress(KeyAscii As Integer)
If KeyAscii <= 32 Then Exit Sub
If Not IsNumeric(Chr(KeyAscii)) Then
KeyAscii = 0
MsgBox "传真号码必须是数字!", vbOKOnly, "输入提示"
End If
End Sub

Private Sub oper_telnotxt_KeyPress(KeyAscii As Integer)
If KeyAscii <= 32 Then Exit Sub
If Not IsNumeric(Chr(KeyAscii)) Then
KeyAscii = 0
MsgBox "电话号码必须是数字!", vbOKOnly, "输入提示"
End If
End Sub


⌨️ 快捷键说明

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