MajP
You've got your good things, and you've got mine.
- Local time
- Today, 04:02
- Joined
- May 21, 2018
- Messages
- 9,284
You can test this by dropping into a standard module. Then you can call it from the immediate window or another function
debug.print GetEmail(1)
should return the email for employeeID 1 if I got the table and field names correct.
debug.print GetEmail(1)
should return the email for employeeID 1 if I got the table and field names correct.
Code:
Public Function GetEmail(empID As Long) As String
If DCount("*", "EmployeeT", "employeeID = " & empID) = 0 Then
MsgBox "No such employeeID found"
Else
GetEmail = Nz(DLookup("EmailWork", "EmployeeT", "EmployeeID = " & empID), "No Email Listed")
End If
End Function