Q:

Started to get a Run-Time error '3159'; Not a Valid bookmark all of a sudden in Access 2007

I am really new to programming access. I converted an old 97 access db to access 2007 and it has been working fine for awhile.  Today I go into it and was snooping around in design view and looking at the code. I didn't change anything. Just looked. When I went to run the code I kept getting the "Not a valid bookmark" error.  Just to be sure I opened up the old program I converted and all the code is the same the line that is giving me the problem is the
Me.Bookmark = pos
The following is the whole routine.
Thanks in advance.
Private Sub ProductID_AfterUpdate()
    Dim pos As Variant
    Me![UnitPrice] = Me![ProductID].Column(2)
    Me![ProductName] = Me![ProductID].Column(1)
    Me![GLAcct] = Me![ProductID].Column(3)
    DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
    pos = Me.Bookmark
    Me.Requery
    Me.Bookmark = pos
End Sub

Edit: I already tried compact and repair.

A:

You will need to change this code as it is out of date for quite some time. I am not sure why it worked in the first place, because the bookmarks will have changed after updating, saving and requerying. I have commented the requery line, because it does not seem to serve a useful purpose, if you wish to update the combo, requery that. If you wish to find a record after an action, save the unique ID to a variable and find it. DoMenuItem is deprecated, you can use RunCommand instead, in this case, however, Me.Dirty=false will save.
Private Sub ProductID_AfterUpdate()
    Dim pos As Variant
    Me![UnitPrice] = Me![ProductID].Column(2)
    Me![ProductName] = Me![ProductID].Column(1)
    Me![GLAcct] = Me![ProductID].Column(3)
    Me.Dirty=False
    'pos = Me.Bookmark
    'Me.Requery 
    'Me.Bookmark = pos
End Sub

