I use an Access database to manage employee information. I want to create a search box, so that when I enter the employee id the rest of the information could be filled automatically.
I created a function to try to get each column's value and assign it when I click the button, but it's not working.
Here is the code:
Public Function GetEmployeeName() As ADODB.Recordset
    Dim rst As ADODB.Recordset
    Set GetEmployeeName = CurrentProject.Connection.Execute("select EmployeeName From EInfor where EmployeeID = " & txtEID.Value)
End Function
Private Sub btnSearch_Click()
    txtEmployeeName = GetEmployeeName()
End Sub
 
     
     
    