Question : FindFirst in Access Form Not Moving to Record Although Record is Found

Hi!  I have two forms in my Access 2003 database.  On one form, the user is on a record when they press the button to go to the other form.  I need to put them on the same record in the other form.  I passed the key field value in a global variable that I pick up in the other form.  The value is there and is being found (I see that by the msgbox), but the form is not moving to that record.  Can anyone please see what I am doing wrong?
Thanks,
Alexis
Code Snippet:
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
MsgBox "btnTest " & gvSampleID
If gvSampleID <> "" Then
 Dim rst As DAO.Recordset
 Set rst = Me.RecordsetClone
 rst.FindFirst "SampleID='" & gvSampleID & "'"
 If rst.NoMatch Then
   MsgBox "No match"
   Else
   MsgBox "match"
 End If
End If
Open in New Window Select All

Answer : FindFirst in Access Form Not Moving to Record Although Record is Found

use the recordset clone to move around your recordet without actually moving the real recordset. to move to found record, use bookmark

eg

If rst.NoMatch Then
   MsgBox "No match"
   Else
   MsgBox "match"
   me.bookmark = rst.bookmark
 End If
Random Solutions  
 
programming4us programming4us