When only one record matches the search criteria findfirst works fine, however the findNext does not return a nomatch condition. Then fatal error when try to delete non-existent record? NoMatch condition ifs never true??
Set db = CurrentDb()
Set JBrec = db.OpenRecordset("JB_Jobs", dbOpenDynaset)
'delete this job and all related records
delstrSql = "JB_Deletesw = true"
JBrec.FindFirst delstrSql
Do While Not JBrec.NoMatch
'Call DeleteAllChildRecords
'MsgBox "Found matching Job record"
JBrec.Delete
MsgBox "Deleted " & strQuote & JB_JobBidNo & strQuote & " Bid record"
JBrec.FindNext delstrSql
If JBrec.NoMatch Then MsgBox "findnext Bid is no match"
Loop
Exit Sub
How do I check for no more records match the search criteria?
Set db = CurrentDb()
Set JBrec = db.OpenRecordset("JB_Jobs", dbOpenDynaset)
'delete this job and all related records
delstrSql = "JB_Deletesw = true"
JBrec.FindFirst delstrSql
Do While Not JBrec.NoMatch
'Call DeleteAllChildRecords
'MsgBox "Found matching Job record"
JBrec.Delete
MsgBox "Deleted " & strQuote & JB_JobBidNo & strQuote & " Bid record"
JBrec.FindNext delstrSql
If JBrec.NoMatch Then MsgBox "findnext Bid is no match"
Loop
Exit Sub
How do I check for no more records match the search criteria?