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

📄 addygmove.frm

📁 一个关于企业工资管理的数据库应用的例子。
💻 FRM
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{F0D2F211-CCB0-11D0-A316-00AA00688B10}#1.0#0"; "MSDATLST.OCX"
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.Form changemove 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "修改调动"
   ClientHeight    =   5070
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   7575
   LinkTopic       =   "Form2"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   5070
   ScaleWidth      =   7575
   Begin MSAdodcLib.Adodc Adodc1 
      Height          =   330
      Left            =   2040
      Top             =   5280
      Visible         =   0   'False
      Width           =   1335
      _ExtentX        =   2355
      _ExtentY        =   582
      ConnectMode     =   0
      CursorLocation  =   3
      IsolationLevel  =   -1
      ConnectionTimeout=   15
      CommandTimeout  =   30
      CursorType      =   3
      LockType        =   3
      CommandType     =   8
      CursorOptions   =   0
      CacheSize       =   50
      MaxRecords      =   0
      BOFAction       =   0
      EOFAction       =   0
      ConnectStringType=   1
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   "Provider=MSDASQL.1;Persist Security Info=False;Data Source=qygzgl"
      OLEDBString     =   "Provider=MSDASQL.1;Persist Security Info=False;Data Source=qygzgl"
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   ""
      Caption         =   "Adodc1"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "MS Sans Serif"
         Size            =   8.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
   Begin VB.CommandButton Command5 
      Caption         =   "保存"
      Height          =   375
      Left            =   6480
      TabIndex        =   15
      Top             =   4080
      Width           =   975
   End
   Begin VB.CommandButton Command4 
      Caption         =   "返回"
      Height          =   375
      Left            =   5160
      TabIndex        =   13
      Top             =   4080
      Width           =   1095
   End
   Begin VB.CommandButton Command3 
      Caption         =   "移动"
      Height          =   375
      Left            =   3720
      TabIndex        =   12
      Top             =   4080
      Width           =   975
   End
   Begin VB.CommandButton Command2 
      Caption         =   "删除"
      Height          =   375
      Left            =   2280
      TabIndex        =   11
      Top             =   4080
      Width           =   1035
   End
   Begin VB.CommandButton Command1 
      Caption         =   "修改"
      Height          =   375
      Left            =   840
      TabIndex        =   10
      Top             =   4080
      Width           =   1095
   End
   Begin VB.Frame Frame1 
      Height          =   3135
      Left            =   1080
      TabIndex        =   0
      Top             =   600
      Width           =   6015
      Begin MSComCtl2.DTPicker DTPicker2 
         Height          =   375
         Left            =   4080
         TabIndex        =   21
         Top             =   2520
         Width           =   1215
         _ExtentX        =   2143
         _ExtentY        =   661
         _Version        =   393216
         Format          =   25362433
         CurrentDate     =   38849
      End
      Begin MSComCtl2.DTPicker DTPicker1 
         Height          =   375
         Left            =   1440
         TabIndex        =   20
         Top             =   2400
         Width           =   1215
         _ExtentX        =   2143
         _ExtentY        =   661
         _Version        =   393216
         Format          =   25362433
         CurrentDate     =   38849
      End
      Begin MSDataListLib.DataCombo DataCombo3 
         Height          =   315
         Left            =   1440
         TabIndex        =   19
         Top             =   360
         Width           =   1095
         _ExtentX        =   1931
         _ExtentY        =   582
         _Version        =   393216
         Text            =   ""
      End
      Begin MSDataListLib.DataCombo DataCombo2 
         Height          =   315
         Left            =   4080
         TabIndex        =   18
         Top             =   1680
         Width           =   1215
         _ExtentX        =   2143
         _ExtentY        =   582
         _Version        =   393216
         Text            =   ""
      End
      Begin MSDataListLib.DataCombo DataCombo1 
         Height          =   315
         Left            =   4080
         TabIndex        =   17
         Top             =   960
         Width           =   1215
         _ExtentX        =   2143
         _ExtentY        =   582
         _Version        =   393216
         Text            =   ""
      End
      Begin VB.TextBox Text3 
         Height          =   285
         Left            =   1440
         TabIndex        =   16
         Top             =   1080
         Width           =   1095
      End
      Begin VB.TextBox Text4 
         Height          =   285
         Left            =   1440
         TabIndex        =   14
         Top             =   1800
         Width           =   1095
      End
      Begin VB.TextBox Text2 
         Height          =   285
         Left            =   4080
         TabIndex        =   9
         Top             =   360
         Width           =   1215
      End
      Begin VB.Label Label8 
         Caption         =   "调出时间:"
         Height          =   375
         Left            =   2880
         TabIndex        =   8
         Top             =   2520
         Width           =   1095
      End
      Begin VB.Label Label7 
         Caption         =   "调入时间:"
         Height          =   375
         Left            =   240
         TabIndex        =   7
         Top             =   2520
         Width           =   1095
      End
      Begin VB.Label Label6 
         Caption         =   "新职务:"
         Height          =   375
         Left            =   2880
         TabIndex        =   6
         Top             =   1800
         Width           =   1095
      End
      Begin VB.Label Label5 
         Caption         =   "原职务:"
         Height          =   375
         Left            =   240
         TabIndex        =   5
         Top             =   1800
         Width           =   1095
      End
      Begin VB.Label Label4 
         Caption         =   "新部门名称:"
         Height          =   375
         Left            =   2880
         TabIndex        =   4
         Top             =   1080
         Width           =   1095
      End
      Begin VB.Label Label3 
         Caption         =   "原部门名称:"
         Height          =   375
         Left            =   240
         TabIndex        =   3
         Top             =   1080
         Width           =   1095
      End
      Begin VB.Label Label2 
         Caption         =   "员工姓名:"
         Height          =   375
         Left            =   2880
         TabIndex        =   2
         Top             =   360
         Width           =   1095
      End
      Begin VB.Label Label1 
         Caption         =   "员工编号:"
         Height          =   375
         Left            =   240
         TabIndex        =   1
         Top             =   360
         Width           =   1095
      End
   End
End
Attribute VB_Name = "changemove"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Sub command3_click()
Dim conn As New ADODB.Connection
conn.Open "Provider=MSDASQL.1;Persist Security Info=False;Data Source=qygzgl"
'RsmodMove.CursorLocation = adUseClient
If RsmodMove.State = adStateClosed Then
  RsmodMove.Open "职工调动信息表", conn, adOpenKeyset, adLockPessimistic, adCmdTable
End If
If RsmodMove.RecordCount > 0 Then
  RsmodMove.MoveNext
  If RsmodMove.EOF Then
     RsmodMove.MoveFirst
  End If
  Call FormTxtValue1
Else
MsgBox "当前没有任何记录", , "移动记录"
End If
End Sub
Private Sub Command4_Click()
Unload Me
End Sub

Private Sub Command2_Click()
If MsgBox("确定要删除吗?", vbInformation + vbYesNo, "删除信息") = vbYes Then
    If RsmodMove.RecordCount <> 0 Then
        RsmodMove.Delete         '//删除记录
        Call command3_click
    Else
        MsgBox "当前没有任何记录", , "删除记录"
        Call FormTxtValue2      '//调用给文本框赋空值的过程
    End If
End If
End Sub
Private Sub command1_click()
Call CmdState1
Call TxtState

End Sub


Private Sub command5_click()
Dim conn As New ADODB.Connection
conn.Open "Provider=MSDASQL.1;Persist Security Info=False;Data Source=qygzgl"
RsmodMove.CursorLocation = adUseClient
If Trim(DataCombo3.Text) <> Empty And Trim(DataCombo1.Text) <> Empty And Trim(DataCombo2.Text) <> Empty Then
Call UpRsValue
RsmodMove.Update
Call command3_click
MsgBox "数据已保存", , "保存成功"
Call CmdState2
Call TxtState1
Else
MsgBox "编号 OR 新部门 OR 新职务 不能为空", , "验证失败"
End If
End Sub
Private Sub FormTxtValue1()
Dim conn As New ADODB.Connection
conn.Open "Provider=MSDASQL.1;Persist Security Info=False;Data Source=qygzgl"
'RsmodMove.CursorLocation = adUseClient
DataCombo3.Text = RsmodMove.Fields(0).value
Text2.Text = RsmodMove.Fields(1).value
Text3.Text = RsmodMove.Fields(2).value
DataCombo1.Text = RsmodMove.Fields(3).value
Text4.Text = RsmodMove.Fields(4).value
DataCombo2.Text = RsmodMove.Fields(5).value
DTPicker1.value = RsmodMove.Fields(6).value
DTPicker2.value = RsmodMove.Fields(7).value
End Sub
Private Sub FormTxtValue2()
DataCombo3.Text = Empty
Text2.Text = Empty
Text3.Text = Empty
DataCombo1.Text = Empty
Text4.Text = Empty
DataCombo2.Text = Empty
DTPicker1.value = Empty
DTPicker2.value = Empty
End Sub
Private Sub UpRsValue()
 Dim conn As New ADODB.Connection
 conn.Open "Provider=MSDASQL.1;Persist Security Info=False;Data Source=qygzgl"
 If RsmodMove.State = adStateClosed Then
  RsmodMove.Open "职工调动信息表", conn, adOpenKeyset, adLockPessimistic, adCmdTable
 End If
 DataCombo3.Text = RsmodMove.Fields(0).value
 Text2.Text = RsmodMove.Fields(1).value
 Text3.Text = RsmodMove.Fields(2).value
 DataCombo1.Text = RsmodMove.Fields(3).value
 Text4.Text = RsmodMove.Fields(4).value
 DataCombo2.Text = RsmodMove.Fields(5).value
 DTPicker1.value = RsmodMove.Fields(6).value
 DTPicker2.value = RsmodMove.Fields(7).value
End Sub
Private Sub TxtState()
DataCombo3.Enabled = True
Text2.Enabled = True
'text3.Enabled = True
DataCombo1.Enabled = True
'text4.Enabled = True
DataCombo2.Enabled = True
DTPicker1.Enabled = True
DTPicker2.Enabled = True
End Sub
Private Sub TxtState1()
DataCombo3.Enabled = False
'text2.Enabled = False
'text3.Enabled = False
DataCombo1.Enabled = False
'text4.Enabled = False
DataCombo2.Enabled = False
DTPicker1.Enabled = False
DTPicker2.Enabled = False
End Sub
Private Sub CmdState1()
Command1.Visible = False
Command2.Visible = False
Command3.Visible = False
Command5.Visible = True
Command4.Enabled = False
End Sub

Private Sub CmdState2()
Command1.Visible = True
Command2.Visible = True
Command3.Visible = True
Command5.Visible = False
Command4.Enabled = True

End Sub

Private Sub DataCombo3_Click(Area As Integer)
Dim conn As New ADODB.Connection
conn.Open "Provider=MSDASQL.1;Persist Security Info=False;Data Source=qygzgl"
'RstName.CursorLocation = adUseClient
If RstName.State = adStateOpen Then
 RstName.Close
End If
RstName.Open "select *from 员工档案表 where 员工编号='" & DataCombo3.Text & "'", conn, adOpenKeyset, adLockOptimistic, adCmdText
 If RstName.RecordCount >= 1 Then
   
    Text2.Text = RstName.Fields(1).value
    Text3.Text = RstName.Fields(16).value
    Text4.Text = RstName.Fields(18).value
 End If
End Sub

Private Sub form_load()
Dim conn As New ADODB.Connection
conn.Open "Provider=MSDASQL.1;Persist Security Info=False;Data Source=qygzgl"
'RsMoveBranch.CursorLocation = adUseClient
'RstMoveTitle.CursorLocation = adUseClient
'rscode1.CursorLocation = adUseClient
If rscode1.State = adStateClosed Then
  rscode1.Open "职工调动信息表", conn, adOpenKeyset, adLockPessimistic, adCmdTable
End If
Set DataCombo3.RowSource = rscode1
DataCombo3.BoundColumn = "员工编号"
DataCombo3.ListField = "员工编号"
If RsMoveBranch.State = adStateClosed Then
  RsMoveBranch.Open "部门管理", conn, adOpenKeyset, adLockPessimistic, adCmdTable
End If
Set DataCombo1.RowSource = RsMoveBranch
DataCombo1.BoundColumn = "部门名称"
DataCombo1.ListField = "部门名称"
If RstMoveTitle.State = adStateClosed Then
  RstMoveTitle.Open "员工职务表", conn, adOpenKeyset, adLockPessimistic, adCmdTable
End If
Set DataCombo2.RowSource = RstMoveTitle
DataCombo2.BoundColumn = "员工职务名称"
DataCombo2.ListField = "员工职务名称"
End Sub

⌨️ 快捷键说明

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