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

📄 fmkhmg.frm

📁 这是一个人事管理软件
💻 FRM
📖 第 1 页 / 共 2 页
字号:
      Appearance      =   1
      BackColor       =   -2147483643
      ForeColor       =   -2147483640
      Orientation     =   0
      Enabled         =   -1
      Connect         =   "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=hgrs;Data Source=SERVER"
      OLEDBString     =   "Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=hgrs;Data Source=SERVER"
      OLEDBFile       =   ""
      DataSourceName  =   ""
      OtherAttributes =   ""
      UserName        =   ""
      Password        =   ""
      RecordSource    =   "kh"
      Caption         =   "Adckhmg"
      BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      _Version        =   393216
   End
   Begin VB.Label Label5 
      Caption         =   "记录"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H8000000D&
      Height          =   255
      Left            =   1680
      TabIndex        =   18
      Top             =   4560
      Width           =   495
   End
   Begin VB.Label Label4 
      Caption         =   "合计"
      BeginProperty Font 
         Name            =   "宋体"
         Size            =   9
         Charset         =   134
         Weight          =   700
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      ForeColor       =   &H8000000D&
      Height          =   255
      Left            =   240
      TabIndex        =   16
      Top             =   4560
      Width           =   495
   End
   Begin VB.Label Label3 
      Caption         =   "卡号"
      Height          =   255
      Left            =   2760
      TabIndex        =   10
      Top             =   480
      Width           =   375
   End
   Begin VB.Label Label2 
      Caption         =   "姓名"
      Height          =   255
      Left            =   1680
      TabIndex        =   9
      Top             =   480
      Width           =   375
   End
   Begin VB.Label Label1 
      Caption         =   "工号"
      Height          =   255
      Left            =   360
      TabIndex        =   8
      Top             =   480
      Width           =   375
   End
End
Attribute VB_Name = "Fmkhmg"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Option Explicit
Dim vbookmark As Variant
Dim lcurrrec As Long
Dim baddnewflag As Boolean
Dim WithEvents adors As Recordset
Attribute adors.VB_VarHelpID = -1

Private Sub Adckhmg_MoveComplete(ByVal adReason As ADODB.EventReasonEnum, ByVal pError As ADODB.Error, adStatus As ADODB.EventStatusEnum, ByVal pRecordset As ADODB.Recordset)
If Not Adckhmg.Recordset.EOF Then
If Not IsNull(Adckhmg.Recordset.Fields("zgid").Value) Then
Text2.Text = Adckhmg.Recordset.Fields("zgid").Value
Else
Text2.Text = ""
End If
If Not IsNull(Adckhmg.Recordset.Fields("zgname").Value) Then
Text3.Text = Adckhmg.Recordset.Fields("zgname").Value
Else
Text3.Text = ""
End If
If Not IsNull(Adckhmg.Recordset.Fields("lskh").Value) Then
Text4.Text = Adckhmg.Recordset.Fields("lskh").Value
Else
Text4.Text = ""
End If
Else
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
End If
End Sub

Private Sub Cmdaction_Click(Index As Integer)
Dim response
Select Case Index
Case 0
If Not (Adckhmg.Recordset.BOF And Adckhmg.Recordset.EOF) Then
vbookmark = Adckhmg.Recordset.Bookmark
End If
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""

Adckhmg.Recordset.AddNew
Cmdaction(4).Enabled = False
baddnewflag = True
setbuttons False
Cmdaction(3).Enabled = True
Case 1
response = MsgBox("Are you sure", vbYesNo, "delete record")
If response = vbYes Then
Adckhmg.Recordset.Delete
Adckhmg.Recordset.MoveNext
End If
If Adckhmg.Recordset.EOF Then
Adckhmg.Recordset.MoveLast
If Adckhmg.Recordset.BOF Then
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
End If
End If
Case 2
Dim vmbmid, vmbmname As String
Adckhmg.RecordSource = "select * from kh where zgid<>'-1' order by zgid "
Adckhmg.Refresh

Adckhmg.Recordset.Requery
Cmdaction(3).Enabled = False

Case 3
response = MsgBox("你确信要更新", vbYesNo, "更新数据")
If response = vbYes Then
Adckhmg.Recordset.Fields("zgid").Value = Text2.Text
Adckhmg.Recordset.Fields("zgname").Value = Text3.Text
Adckhmg.Recordset.Fields("lskh").Value = Text4.Text
Adckhmg.Recordset.UpdateBatch adAffectAll

End If
setbuttons True
Cmdaction(4).Enabled = True
Cmdaction(3).Enabled = False
Case 4
response = MsgBox("你确信取消操作", vbYesNo, "取消操作")
If response = vbYes Then
setbuttons True
Adckhmg.Recordset.Cancel
If vbookmark > 0 Then
Adckhmg.Recordset.Bookmark = vbookmark
Else
lcurrrec = 1
Adckhmg.Recordset.MoveFirst
End If
Cmdaction(3).Enabled = False
baddnewflag = False
End If
End Select
End Sub
Private Sub setbuttons(bval As Boolean)
Cmdaction(0).Enabled = bval
Cmdaction(1).Enabled = bval
Cmdaction(2).Enabled = bval
End Sub


Private Sub cmdexit_Click(Index As Integer)
Cmdaction(3).Enabled = True
End Sub

Private Sub Command1_Click()
Dim iresponse As Integer
If Cmdaction(3).Enabled Then
iresponse = MsgBox("data changed ,save it?", vbYesNo, "update data?")
If iresponse = vbYes Then
adors.UpdateBatch adAffectAll
 Else
adors.CancelUpdate
End If
End If
adors.Close
Unload Me
End Sub

Private Sub Command2_Click()
Dim vzgid
vzgid = Text1.Text
Adckhmg.RecordSource = "select * from kh where zgid= '" & vzgid & "'"
Adckhmg.Refresh
If Not Adckhmg.Recordset.EOF Then
If Not IsNull(Adckhmg.Recordset.Fields("zgid").Value) Then
Text2.Text = Adckhmg.Recordset.Fields("zgid").Value
Else
Text2.Text = ""
End If
If Not IsNull(Adckhmg.Recordset.Fields("zgname").Value) Then
Text3.Text = Adckhmg.Recordset.Fields("zgname").Value
Else
Text3.Text = ""
End If
If Not IsNull(Adckhmg.Recordset.Fields("lskh").Value) Then
Text4.Text = Adckhmg.Recordset.Fields("lskh").Value
Else
Text4.Text = ""
End If
End If
End Sub

Private Sub DataGrid1_Change()
Cmdaction(3).Enabled = True
End Sub

Private Sub DG1_KeyPress(KeyAscii As Integer)
If KeyAscii = 24 Then
Adckhmg.Recordset.MovePrevious
If Adckhmg.Recordset.BOF Then
Adckhmg.Recordset.MoveFirst
End If
End If
If KeyAscii = 25 Then
Adckhmg.Recordset.MoveNext
If Adckhmg.Recordset.EOF Then
Adckhmg.Recordset.MoveLast
End If
End If

End Sub

Private Sub Form_Load()
Adckhmg.RecordSource = "select * from kh where zgid<>'-1' order by zgid "
Adckhmg.Refresh
If Not Adckhmg.Recordset.EOF Then
Textcount.Text = Adckhmg.Recordset.RecordCount
End If
Set adors = Adckhmg.Recordset
Text2.Text = adors.Fields("zgid").Value
Text3.Text = adors.Fields("zgname").Value
Text4.Text = adors.Fields("lskh").Value
DG1.Columns(0).Caption = "员工编号"
DG1.Columns(1).Caption = "员工名称"
DG1.Columns(2).Caption = "所用卡号"
DG1.Columns(3).Caption = "班别代号"

End Sub

Private Sub Text1_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
Command2.SetFocus
End If
End Sub

Private Sub Text2_Change()
Dim vzgid
vzgid = Text2.Text
adczg.RecordSource = "select * from tzg where zgid='" & vzgid & "'"
adczg.Refresh
If Not adczg.Recordset.EOF Then
Text3.Text = adczg.Recordset.Fields("zgname").Value
Else
Text3.Text = ""
End If
End Sub

⌨️ 快捷键说明

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