I'm running code to pull records from a table if it matches a key and a date. My code errors out if there are no records found. I can't figure out how to catch the No Match, so if it is true then it skips to the next section. It was first giving me Error 1004 (I didn't have the MoveNext or If then statement). Once I added the MoveNext/If Then, it started giving me Error 3021: No current record.
I know I'm missing something simple... Any help?? All I need to do is skip to the next section if there are no records returned in the SQL Statement...
Thanks!
Carie
I know I'm missing something simple... Any help?? All I need to do is skip to the next section if there are no records returned in the SQL Statement...
Code:
strSQLExp = "Select * From 203_ACC_Contracts_Exp_tbl WHERE fld_ACC_Master_Record_No = " & Me!txt_MasterNo_to_Lookup & " AND fld_Exp_Year = '2003';"
Set rst = DB.OpenRecordset(strSQLExp)
rst.MoveNext
If rst.NoMatch Then
GoTo REVTBL
End If
Thanks!
Carie