Could someone help me write an error handler please? I feel like I've tried every which way and I'm just not getting the code right.
I have a button on a form that calls a Sub
Sub Search ()
Dim strCriteria, ... ... ...
task = "select * from [qryFinancialsByMonth2] where (" & strCriteria & ")"
Me.FilterOn = True
If the strCriteria is blank when the task filter is applied, then Access says "Run-time error 3075, Syntax error missing operator in query expression..."
I'd like to replace that MsgBox with one saying "Please select at least one criteria for the search." with a simple OK button to click.
As I said, I've tried several different things. I'm not sure any of them are worth posting. But here's one of them:
On Error GoTo Error_Search
If IsNull strCriteria Then
MsgBox "Please select at least one criteria to search for.", vbOKOnly
If Err.Number = 3075 Then
Much appreciate any help.