frmForm - 1
Option Explicit
Public EnableEvents As Boolean
Private Sub cmbSearchColumn_Change()
If [Link] = False Then Exit Sub
If [Link] = "All" Then
Call Reset
Else
[Link] = ""
[Link] = True
[Link] = True
End If
End Sub
Private Sub cmdDelete_Click()
Dim iRow As Long
If Selected_List = 0 Then
MsgBox "No row is selected.", vbOKOnly + vbInformation, "Delete"
Exit Sub
End If
Dim i As VbMsgBoxResult
i = MsgBox("Do you want to delete the selected record?", vbYesNo + vbQuestion, "Confirmation")
If i = vbNo Then Exit Sub
iRow = [Link]([Link]([Link], 0), _
[Link]("Database").Range("A:A"), 0)
[Link]("Database").Rows(iRow).Delete
Call Reset
MsgBox "Selected record has been deleted.", vbOKOnly + vbInformation, "Deleted"
End Sub
Private Sub cmdEdit_Click()
If Selected_List = 0 Then
MsgBox "No row is selected.", vbOKOnly + vbInformation, "Edit"
Exit Sub
End If
'Code to update the value to respective controls
Dim sGender As String
[Link] = [Link]([Link]([Link].
ListIndex, 0), _
[Link]("Database").Range("A:A"), 0)
[Link] = [Link]([Link], 1)
[Link] = [Link]([Link], 2)
sGender = [Link]([Link], 3)
If sGender = "Female" Then
[Link] = True
frmForm - 2
Else
[Link] = True
End If
[Link] = [Link]([Link], 4)
[Link] = [Link]([Link], 5)
[Link] = [Link]([Link], 6)
MsgBox "Please make the required changes and click on 'Save' button to update.", vbOKOnly + vbI
nformation, "Edit"
End Sub
Private Sub cmdFullScreen_Click()
Call Maximize_Restore
End Sub
Private Sub cmdPrint_Click()
Dim msgValue As VbMsgBoxResult
msgValue = MsgBox("Do you want to print the employee details?", vbYesNo + vbInformation, "Print
")
If msgValue = vbNo Then Exit Sub
If ValidatePrintDetails() = True Then
Call Print_Form
End If
End Sub
Private Sub cmdReset_Click()
Dim msgValue As VbMsgBoxResult
msgValue = MsgBox("Do you want to reset the form?", vbYesNo + vbInformation, "Confirmation")
If msgValue = vbNo Then Exit Sub
Call Reset
End Sub
Private Sub cmdSave_Click()
Dim msgValue As VbMsgBoxResult
msgValue = MsgBox("Do you want to save the data?", vbYesNo + vbInformation, "Confirmation")
If msgValue = vbNo Then Exit Sub
If ValidateEntries() = True Then
Call Submit
Call Reset
End If
End Sub
Private Sub cmdSearch_Click()
If [Link] = "" Then
MsgBox "PLease enter the search value.", vbOKOnly + vbInformation, "Search"
Exit Sub
frmForm - 3
End If
Call SearchData
End Sub
Private Sub UserForm_Initialize()
Call Reset
End Sub