I have this code with an "On Error Resume Next" statement that is not trapping the error.
The program displays an error message to the user:
The line that causes this error is highlighted.
All I want the program to do is ignore the error end continue, without interrupting the user.
Any ideas?
Thanks!
Code:
Public Function FetchSupplementUnits2() As String
'Fetch supplement units description for Supplements Intake of Treatment
On Error GoTo FormNotLoaded_Exit
If IsNull(Forms!frmTreatments.Form!sfrmSupplementsIntakeOfTreatment![Supplement_Code]) Then
Exit Function
End If
On Error GoTo 0
Dim strUnitCode As String
[B]On Error Resume Next[/B]
strUnitCode = DLookup("[Units_Code]", "tblProducts", "[Supplement_Code]=Forms!frmTreatments.Form!sfrmSupplementsIntakeOfTreatment![Supplement_Code]")
[B]FetchSupplementUnits2 = DLookup("[Units_Description]", "tblUnits_table", "[Units_Code]=" & strUnitCode[/B])
On Error GoTo 0
FormNotLoaded_Exit:
Exit Function
End Function
The program displays an error message to the user:
Syntax error (missing operator) in query expression '[Unit_Code]='.
The line that causes this error is highlighted.
All I want the program to do is ignore the error end continue, without interrupting the user.
Any ideas?
Thanks!