G
Guest
Hi there,
I just want to write a function that takes in an employee number and returns
their name. All my tables that refer to an employee use their ID number, but
I'd like their names to display on each page they're logged into.
I originally wrote it with DoCmd.RunSQL but I read somewhere that you can
only use that on update queries. I'm still quite new to VB/Access so I don't
really know how to use Dao or even what it does =(
Public Function getEmployeeName(empNum As Integer)
Dim strLastName As String
strLastName = DoCmd.RunSQL("SELECT Employees.Last_Name" & _
" FROM Employees" & _
" WHERE (((Employees.Employee_ID)=empNum)")
getEmployeeName = strLastName
End Function
Thanks in advance
Nick
I just want to write a function that takes in an employee number and returns
their name. All my tables that refer to an employee use their ID number, but
I'd like their names to display on each page they're logged into.
I originally wrote it with DoCmd.RunSQL but I read somewhere that you can
only use that on update queries. I'm still quite new to VB/Access so I don't
really know how to use Dao or even what it does =(
Public Function getEmployeeName(empNum As Integer)
Dim strLastName As String
strLastName = DoCmd.RunSQL("SELECT Employees.Last_Name" & _
" FROM Employees" & _
" WHERE (((Employees.Employee_ID)=empNum)")
getEmployeeName = strLastName
End Function
Thanks in advance
Nick