Hello,
I have an access database with 3 tables. The table i am working on is tblemployee.
On a form i have a combo box with the employee numbers. Now, when a user chooses an employee number from the drop down box, i want the initial and name of that employee to appear in a non-editable text box.
I have been trying to get this to work but get errors.
Private Sub Employee_Change()
If Employee.Text > 0 Then
txtname.Visible = True
Dim Sqltxt As String
Sqltxt = "SELECT surname FROM TBLEmployee where [employee number] = " & Employee
DoCmd.OpenQuery (Sqltxt)
Else
txtname.Visible = False
End If
End Sub
I have put the above in the On Change Event in combo box "Employee".
Any help would be greatley apreaciated.
Thank you