Info

With a change in code as shown in the following sample, the same form design can be used to retrieve information. The following sample retrieves the position and hire date after the employee name has been entered:

Private Sub btn_EmpOK_Click() Dim EmpFound As Range With Range("EmpList")

Set EmpFound = .Find(tb_EmpName.Value) If EmpFound Is Nothing Then

MsgBox ("Employee not found!") tb_EmpName.Value = "" Exit Sub

Else

With Range(EmpFound.Address)

tb_EmpPosition = .Offset(0, 1) tb_HireDate = .Offset(0, 2) End With End If End With End Sub

0 0

Post a comment