I have two tables that are related, I'm trying to get data from the "parent" table using information in the "child" table. I'm attempting to use DLookup but I am getting a mismatch data type error.
I have a username variable available in the sub I am calling from and have created the below code:
Dim sqlstr As String
Dim placehldr As Long
username = Me.OpenArgs
placehldr = DLookup("userFullName", "tblUsers", "username='" & username & "'")
userFullName = DLookup("employeeFullName", "tblEmployees", "[ID]='&placehldr&'")
placehldr looks up according to a username the userFullName field which was created with lookup wizard so that users can look up the employee. This returns the autoID number from the first table tblEmployees. I have tried this using placehldr as long, integer, and string, and I have tried placing apostrophes as if it were a string or integer, I have also tried mixing these and using string apostrophes with int/long etc. It always returns the same mismatch type error on the second DLookup. Any help would be appreciated.