I am using the Find method to locate a record in the record set. However, when there isn't a record for the particular product it shows the first product of the recrod set. I have written the code which checks the recordset's No Match property and it seems to do what it is suppose to except in loops through the code multiple times before it finishes. What am I missing? Here's a sample of the code
'Find the Product Code that matches the Product Code entered by the user
RS.FindFirst "[FG-PROD-CD] = '" & StrProduct & "'"
'If the record does not exist for the Product display a message and return to the previous screen
If RS.NoMatch Then
MsgBox "There are no Approved Countries for this Product", , "NO MATCH"
Me.Visible = False
Form_frmPrimIndx.Visible = True
'if records exist for the product
Else
'Set a Bookmark for that Product in the Record Set
Me.Bookmark = RS.Bookmark
'Set the focus to the first field on the form
Me.cmdDone.SetFocus
'Close the Record Set
RS.Close
End If
'Find the Product Code that matches the Product Code entered by the user
RS.FindFirst "[FG-PROD-CD] = '" & StrProduct & "'"
'If the record does not exist for the Product display a message and return to the previous screen
If RS.NoMatch Then
MsgBox "There are no Approved Countries for this Product", , "NO MATCH"
Me.Visible = False
Form_frmPrimIndx.Visible = True
'if records exist for the product
Else
'Set a Bookmark for that Product in the Record Set
Me.Bookmark = RS.Bookmark
'Set the focus to the first field on the form
Me.cmdDone.SetFocus
'Close the Record Set
RS.Close
End If