NO MATCH

Tammy

Registered User.
Local time
Today, 01:12
Joined
Mar 29, 2000
Messages
14
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
 
don't do:
Me.Bookmark = RS.Bookmark
If you 'transfer' bookmarks, both recordsets need to be identical!

instead use this:

set rs1=me.RecordsetClone
rs1.FindFirst <criteria>
if rs1.NoMatch then goto doSomethingElse
me.Bookmark=rs1.Bookmark
set rs1=nothing

Although: this means you need to find data matching this criteria in that form..

Hope this helps!
 

Users who are viewing this thread

Back
Top Bottom