I have the following lines:
Set rst3 = db.OpenRecordset("SELECT * from MainRptDataASD where PlanID = " & MyPlanID & " and PmtYr = " & mypmtyr & " and Ltrim(ASD) = ' " & myASD & " ' and Ltrim(IPR) = ' " & myIPR & " '")
If rst3.NoMatch Then
CurrentDb.Execute "INSERT into MainRptDataASD(PlanID, PmtYr,IPR, ASD) VALUES(' " & MyPlanID & " ' , ' " & mypmtyr & " ' , ' " & myIPR & " ' , ' " & myASD & "')"
End If
The rst3.nomatch doesn't seem to work. Even though there is no matching record meeting the above criteria it never performs the INSERT.
Set rst3 = db.OpenRecordset("SELECT * from MainRptDataASD where PlanID = " & MyPlanID & " and PmtYr = " & mypmtyr & " and Ltrim(ASD) = ' " & myASD & " ' and Ltrim(IPR) = ' " & myIPR & " '")
If rst3.NoMatch Then
CurrentDb.Execute "INSERT into MainRptDataASD(PlanID, PmtYr,IPR, ASD) VALUES(' " & MyPlanID & " ' , ' " & mypmtyr & " ' , ' " & myIPR & " ' , ' " & myASD & "')"
End If
The rst3.nomatch doesn't seem to work. Even though there is no matching record meeting the above criteria it never performs the INSERT.