📄 frmeditemployee.frm
字号:
Caption = "City"
BeginProperty Font
Name = "Verdana"
Size = 9
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 210
Left = 480
TabIndex = 25
Top = 2640
Width = 390
End
Begin VB.Label lbladdress
AutoSize = -1 'True
Caption = "Address"
BeginProperty Font
Name = "Verdana"
Size = 9
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 210
Left = 480
TabIndex = 24
Top = 2280
Width = 795
End
Begin VB.Label lblemployeename
AutoSize = -1 'True
Caption = "Name"
BeginProperty Font
Name = "Verdana"
Size = 9
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 210
Left = 480
TabIndex = 23
Top = 1920
Width = 570
End
Begin VB.Label lblExp
AutoSize = -1 'True
Caption = "Experience Summary"
BeginProperty Font
Name = "Verdana"
Size = 9
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 210
Left = 480
TabIndex = 22
Top = 5880
Width = 2100
End
Begin VB.Label lblDepartment
AutoSize = -1 'True
Caption = "Department"
BeginProperty Font
Name = "Verdana"
Size = 9
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 210
Left = 480
TabIndex = 21
Top = 5520
Width = 1170
End
Begin VB.Label lblqualification
AutoSize = -1 'True
Caption = "Edu. Qualification"
BeginProperty Font
Name = "Verdana"
Size = 9
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 210
Left = 480
TabIndex = 20
Top = 4080
Width = 1740
End
Begin VB.Label lbldesignation
AutoSize = -1 'True
Caption = "Appointed As"
BeginProperty Font
Name = "Verdana"
Size = 9
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 210
Left = 480
TabIndex = 19
Top = 5160
Width = 1290
End
Begin VB.Line Line1
X1 = 0
X2 = 8160
Y1 = 960
Y2 = 960
End
Begin VB.Label lblTitle
AutoSize = -1 'True
Caption = "EDIT EMPLOYEE RECORD"
BeginProperty Font
Name = "Verdana"
Size = 12
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 270
Left = 2040
TabIndex = 18
Top = 240
Width = 3390
End
Begin VB.Label lblDOJ
AutoSize = -1 'True
Caption = "Date Of Joining"
BeginProperty Font
Name = "Verdana"
Size = 9
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 210
Left = 480
TabIndex = 17
Top = 4800
Width = 1530
End
Begin VB.Label lblDate
AutoSize = -1 'True
Caption = "Date"
BeginProperty Font
Name = "Verdana"
Size = 9
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00FF0000&
Height = 210
Left = 6240
TabIndex = 16
Top = 1200
Width = 465
End
End
Attribute VB_Name = "frmEditemployee"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
'Variable Declaration
Dim i, J As Integer
Public Sub LCK()
txtemployeename.Locked = True
txtaddress.Locked = True
txtcity.Locked = True
txtState.Locked = True
txtpin.Locked = True
txtphone.Locked = True
txteduqualification.Locked = True
txtdesignation.Locked = True
txtDepartment.Locked = True
txtExp.Locked = True
txtDOJ.Locked = True
End Sub
Private Sub cboID_Click()
If cboID.ListIndex = -1 Then
cmdEdit.Enabled = False
Exit Sub
End If
With rs
.MoveLast
.MoveFirst
.Requery
While .EOF = False
If cboID.List(cboID.ListIndex) = .Fields(0) Then
txtemployeename.Text = .Fields(1)
txtaddress.Text = .Fields(2)
txtcity.Text = .Fields(3)
txtState.Text = .Fields(4)
txtpin.Text = .Fields(5)
txtphone.Text = .Fields(6)
txtDOJ.Text = .Fields(7)
txteduqualification.Text = .Fields(8)
txtdesignation.Text = .Fields(9)
txtDepartment.Text = .Fields(10)
txtExp.Text = .Fields(11)
.MoveNext
Else
.MoveNext
End If
Wend
End With
cmdEdit.Enabled = True
End Sub
Private Sub cmdCancel_Click()
Unload Me
Me.Visible = False
End Sub
Private Sub cmdEdit_Click()
cmdEdit.Enabled = False
cmdSave.Enabled = True
txtemployeename.Locked = False
txtaddress.Locked = False
txtcity.Locked = False
txtState.Locked = False
txtpin.Locked = False
txtphone.Locked = False
txteduqualification.Locked = False
txtdesignation.Locked = False
txtDepartment.Locked = False
txtExp.Locked = False
txtDOJ.Locked = False
End Sub
Private Sub cmdsave_click()
Dim StrSql As String
txtemployeename.SetFocus
With rs
.MoveLast
.MoveFirst
While .EOF = False
If cboID.List(cboID.ListIndex) = .Fields(0) Then
StrSql = "UPDATE PresentEmp_Table SET Name = '" & txtemployeename.Text & "'," _
& "Address = '" & txtaddress.Text & "'," _
& "City = '" & txtcity.Text & "'," _
& "State = '" & txtState.Text & "'," _
& "Pin = '" & txtpin.Text & "'," _
& "Phone = '" & txtphone.Text & "'," _
& "DOJ = '" & txtDOJ.Text & "'," _
& "Education = '" & txteduqualification.Text & "'," _
& "Designation = '" & txtdesignation.Text & "'," _
& "Department = '" & txtDepartment.Text & "'," _
& "Exp = '" & txtExp.Text & "' " _
& "WHERE EmpID = '" & cboID.List(cboID.ListIndex) & "';"
cnn.Execute StrSql
.Update
MsgBox "Record Is updated"
.MoveNext
Else
.MoveNext
End If
Wend
End With
cmdSave.Enabled = False
cmdEdit.Enabled = True
LCK
txtemployeename.Text = ""
txtaddress.Text = ""
txtcity.Text = ""
txtState.Text = ""
txtpin.Text = ""
txtphone.Text = ""
txteduqualification.Text = ""
txtdesignation.Text = ""
txtDepartment.Text = ""
txtExp.Text = ""
txtDOJ.Text = ""
cboID.ListIndex = -1
cboID.SetFocus
End Sub
Private Sub Form_Load()
Me.Top = 3000
Me.Left = 3000
lblDate.Caption = Date
Call Connect
cmdSave.Enabled = False
cmdEdit.Enabled = False
LCK
With rs
If .RecordCount = 0 Then
MsgBox "There are no records"
' Unload Me
Exit Sub
Else
.MoveLast
i = .RecordCount
.MoveFirst
For J = 1 To i
cboID.AddItem .Fields(0)
.MoveNext
Next
End If
End With
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -