This code looks like it should work but all I get is datatype mismatch errors
Any help would be appreciated
Public Function getUnmatchedUnit(lngVisitNo As Long) As String
If Not IsNull(DLookup("[Unit]", "[tblUnmatchedUnits]", _
"[Visit_no]=" & lngVisitNo)) Then
getUnmatchedUnit = (DLookup("[Unit]", "[tblUnmatchedUnits]", _
"[Visit_no]=" & lngVisitNo))
getUnmatchedUnit = "???"
Got it. The problem was a data type mismatch in the table. But if I changed the type there then other things broke. Been stumped on this before but i had an insight today. I fixed it by downloading the key field data twice into a local table. one field is numeric and one field text. That way I can link to whichever data type I need it to be.