Requery and stay on current record

  • How do you do a requery without returning to the first record? I need to stay on the current record.

    Is there a simple solution.  Thanks

  • You'll have to write some code.  Create a button on the form and change the lable to "Refresh".  Add code to the click event

    The code (not debugged) looks like this:

    Dim ID as int 'or whatever datatype your key is

    Dim rs as Object

    'save the current id

    ID = Me.IDField 'or whatever your key is called

    'refresh the form

    Me.requery

    'find the record

    Set rs = Me.Recordset.Clone

    rs.FindFirst "[IDFIeld] = " & ID

    'move to the record

    If Not rs.EOF Then Me.Bookmark = rs.Bookmark

    Hope this helps,

    Kathi

     

     

     

     

     

    Aunt Kathi Data Platform MVP
    Author of Expert T-SQL Window Functions
    Simple-Talk Editor

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply