xggzxx.frm

来自「一个关于企业工资管理的数据库应用的例子。」· FRM 代码 · 共 582 行 · 第 1/2 页

FRM
582
字号
         Caption         =   "补贴:"
         Height          =   255
         Left            =   120
         TabIndex        =   6
         Top             =   720
         Width           =   615
      End
      Begin VB.Label Label4 
         Caption         =   "底薪:"
         Height          =   255
         Left            =   120
         TabIndex        =   5
         Top             =   240
         Width           =   735
      End
   End
   Begin VB.Frame Frame1 
      Height          =   1095
      Left            =   120
      TabIndex        =   0
      Top             =   120
      Width           =   6015
      Begin MSDataListLib.DataCombo DataCombo1 
         Height          =   330
         Left            =   360
         TabIndex        =   33
         Top             =   720
         Width           =   1335
         _ExtentX        =   2355
         _ExtentY        =   582
         _Version        =   393216
         Enabled         =   0   'False
         Text            =   ""
      End
      Begin VB.TextBox Text12 
         DataField       =   "员工姓名"
         DataSource      =   "Adodc1"
         Enabled         =   0   'False
         Height          =   270
         Left            =   2160
         TabIndex        =   32
         Top             =   720
         Width           =   1335
      End
      Begin VB.TextBox Text10 
         DataField       =   "所在部门"
         DataSource      =   "Adodc1"
         Enabled         =   0   'False
         Height          =   270
         Left            =   4200
         TabIndex        =   30
         Top             =   720
         Width           =   1335
      End
      Begin VB.Label Label3 
         Caption         =   "所在部门"
         Height          =   255
         Left            =   4440
         TabIndex        =   3
         Top             =   360
         Width           =   855
      End
      Begin VB.Label Label2 
         Caption         =   "员工姓名"
         Height          =   255
         Left            =   2400
         TabIndex        =   2
         Top             =   360
         Width           =   735
      End
      Begin VB.Label Label1 
         Caption         =   "员工编号"
         Height          =   255
         Left            =   480
         TabIndex        =   1
         Top             =   360
         Width           =   855
      End
   End
End
Attribute VB_Name = "xggzxx"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Private Sub TxtState1()
Text1.Enabled = False
Text2.Enabled = False
Text3.Enabled = False
Text4.Enabled = False
Text5.Enabled = False
Text6.Enabled = False
Text7.Enabled = False
Text8.Enabled = False
'Text9.Enabled = False
'Text10.Enabled = False
DataCombo1.Enabled = False
'Text12.Enabled = False
End Sub


Private Sub Command1_Click()
Command1.Visible = False
Command2.Visible = False
Command3.Visible = False
Command4.Enabled = False
Command5.Visible = True
Call TxtState
End Sub

Private Sub Command2_Click()
'Dim rs As New ADODB.Recordset
If Adodc1.Recordset.RecordCount <> 0 Then
    Adodc1.Recordset.MoveNext
    If Adodc1.Recordset.EOF Then
        Adodc1.Recordset.MoveFirst
    End If
    Call value1
Else
MsgBox "当前没有任何记录", , "移动记录"
End If
End Sub

Private Sub command3_click()
'Dim rs As New ADODB.Recordset
'If Not (Adodc1.Recordset.EOF Or Adodc1.Recordset.BOF) Then
    If MsgBox("您确定要删除吗?", vbInformation + vbYesNo, "删除信息") = vbYes Then
        
        If Adodc1.Recordset.RecordCount = 0 Then
            MsgBox "当前没有任何记录", , "删除记录"
           Adodc1.Refresh
           
           Call Command2_Click
                 Else
            Adodc1.Recordset.Delete
            MsgBox ("删除成功!")
       ' Call value2
        End If
    'End If
End If
End Sub

Private Sub Command4_Click()
Unload Me
End Sub
Private Sub value1()
'Dim rs As New ADODB.Recordset
DataCombo1.Text = Adodc1.Recordset.Fields(0).value
Text12.Text = Adodc1.Recordset.Fields(1).value
Text10.Text = Adodc1.Recordset.Fields(2).value
Text1.Text = Adodc1.Recordset.Fields(3).value
Text2.Text = Adodc1.Recordset.Fields(5).value
Text3.Text = Adodc1.Recordset.Fields(7).value
Text4.Text = Adodc1.Recordset.Fields(4).value
Text5.Text = Adodc1.Recordset.Fields(6).value
'Text6.Text = Adodc1.Recordset.Fields(12).value
Text7.Text = Adodc1.Recordset.Fields(8).value
Text8.Text = Adodc1.Recordset.Fields(9).value
Text9.Text = Adodc1.Recordset.Fields(10).value
DTPicker1.value = Adodc1.Recordset.Fields(11).value
End Sub
Private Sub value2()
DataCombo1.Text = Empty
Text12.Text = Empty
Text10.Text = Empty
Text1.Text = Empty
Text2.Text = Empty
Text3.Text = Empty
Text4.Text = Empty
Text5.Text = Empty
Text6.Text = Empty
Text7.Text = Empty
Text8.Text = Empty
Text9.Text = Empty

End Sub
Private Sub TxtState()
DataCombo1.Enabled = True
'text12.Enabled=True
'Text10.Enabled = True
Text1.Enabled = True
Text2.Enabled = True
Text3.Enabled = True
Text4.Enabled = True
Text5.Enabled = True
Text6.Enabled = True
Text7.Enabled = True
Text8.Enabled = True
'Text9.Enabled = True

End Sub

Private Sub command5_click()
Dim rs As New ADODB.Recordset
Dim conn As New ADODB.Connection
conn.Open "DSN=qygzgl"
rs.CursorLocation = adUseClient
'Dim sql As String

'On Error GoTo errsave
    Call value
    Adodc1.Recordset.Update
    Call Command2_Click
    MsgBox "数据已被保存", , "保存成功"
    Call CmdState2
    Call TxtState1
End Sub
Private Sub value()
'Dim rs As New ADODB.Recordset
Adodc1.Recordset.Fields(0).value = DataCombo1.Text
Adodc1.Recordset.Fields(1).value = Text12.Text
Adodc1.Recordset.Fields(2).value = Text10.Text
Adodc1.Recordset.Fields(3).value = Text1.Text
Adodc1.Recordset.Fields(5).value = Text2.Text
Adodc1.Recordset.Fields(7).value = Text3.Text
Adodc1.Recordset.Fields(4).value = Text4.Text
Adodc1.Recordset.Fields(6).value = Text5.Text
Adodc1.Recordset.Fields(12).value = Text6.Text
Adodc1.Recordset.Fields(8).value = Text7.Text
Adodc1.Recordset.Fields(9).value = Text8.Text
Adodc1.Recordset.Fields(10).value = Text9.Text
Adodc1.Recordset.Fields(11).value = DTPicker1.value

End Sub
Private Sub CmdState1()
Command1.Visible = False
Command2.Visible = False
Command3.Visible = False
Command4.Enabled = False
Command5.Visible = True
End Sub
Private Sub CmdState2()
Command1.Visible = True
Command2.Visible = True
Command3.Visible = True
Command4.Enabled = True
Command5.Visible = True
End Sub
Private Sub change()
Text9.Text = Val(Text1.Text) + Val(Text2.Text) + Val(Text3.Text) + Val(Text4.Text) + Val(Text5.Text) + Val(Text6.Text) - Val(Text7.Text) - Val(Text8.Text)
End Sub


Private Sub Form_Load()
Dim conn As New ADODB.Connection
conn.Open "Provider=MSDASQL.1;Persist Security Info=False;Data Source=qygzgl"
rst.CursorLocation = adUseClient
If rst.State = adStateOpen Then
rst.Open "员工工资表", conn, adOpenKeyset, adLockPessimistic, adCmdTable
'rst.Close
End If
Set DataCombo1.DataSource = rst
DataCombo1.BoundColumn = "员工编号"
DataCombo1.ListField = "员工编号"
Call value1

End Sub

Private Sub Text1_Change()
Call change
End Sub

Private Sub Text2_Change()
Call change
End Sub

Private Sub Text4_Change()
Call change
End Sub

Private Sub Text5_Change()
Call change
End Sub

Private Sub Text6_Change()
Call change
End Sub

Private Sub Text7_Change()
Call change
End Sub

Private Sub Text8_Change()
Call change
End Sub

Private Sub Text9_Change()
Call change
End Sub

⌨️ 快捷键说明

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