Results 1 to 5 of 5
  1. #1
    ybg1 is offline Novice
    Windows XP Access 2003
    Join Date
    Nov 2010
    Posts
    23

    Bookmark problem

    I'm using the following to bring a person details using a Barcode .
    It works fine.
    But if I'm using the same barcode again on the already found person,
    for some reason it brings me a person that is not related to this barcode.
    In the third attempt it will bring me the right person... and so on.


    Private Sub Barcode_AfterUpdate()


    Dim rst As DAO.Recordset
    Dim strCriteria As String
    strCriteria = "[Bar_Code] = " & Me.Barcode
    Set rst = Me.RecordsetClone
    rst.FindFirst strCriteria
    If rst.NoMatch Then
    MsgBox "No entry found.", vbInformation
    Else
    Me.Bookmark = rst.Bookmark
    End If
    Set rst = Nothing
    End Sub

    am I missing something?

  2. #2
    Join Date
    Nov 2011
    Location
    Hamilton, NZ
    Posts
    18
    set the recordset before the search criteria...

    Private Sub Barcode_AfterUpdate()
    Dim rst As DAO.Recordset
    Dim strCriteria As String
    Set rst = Me.RecordsetClone
    strCriteria = "[Bar_Code] = " & Me.Barcode
    rst.FindFirst strCriteria
    If rst.NoMatch Then
    MsgBox "No entry found.", vbInformation
    Else
    Me.Bookmark = rst.Bookmark
    End If
    Set rst = Nothing
    End Sub

  3. #3
    ybg1 is offline Novice
    Windows XP Access 2003
    Join Date
    Nov 2010
    Posts
    23
    Didn't help

  4. #4
    Join Date
    Nov 2011
    Location
    Hamilton, NZ
    Posts
    18
    Bar_Code - is that a number or text field. Are you getting any error message ? did you try debugging the code ?

  5. #5
    ybg1 is offline Novice
    Windows XP Access 2003
    Join Date
    Nov 2010
    Posts
    23
    It is a numeric field. I don't get any error.
    I've decided to forget the Bookmark and I'm using Filter instead.

    strWhere = "[Bar_Code]=" & Me.Barcode
    Me.Filter = strWhere
    Me.FilterOn = True

    Works great.

    Thanks for your response.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. What does "not a valid bookmark" mean?
    By ejohnso4 in forum Forms
    Replies: 3
    Last Post: 06-05-2014, 08:49 AM
  2. "Not a valid bookmark" error...??????
    By jgelpi16 in forum Programming
    Replies: 2
    Last Post: 06-16-2011, 11:50 AM
  3. Move bookmark to "new" record
    By BayerMeister in forum Forms
    Replies: 9
    Last Post: 08-17-2010, 05:16 AM
  4. Opening form to correct record. Bookmark?
    By stephenaa5 in forum Forms
    Replies: 11
    Last Post: 12-29-2009, 02:43 PM
  5. Bookmark a record in a Form?
    By westcoastbmx in forum Forms
    Replies: 3
    Last Post: 10-29-2009, 03:13 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums