Requery

  • Thread starter radarlarry1 via AccessMonster.com
  • Start date
R

radarlarry1 via AccessMonster.com

I'm updating my table thru a form and a macro containing a requery command.
When I do this it updates fine but it requeries the entire table and the form
reverts back to the first entry in the table. It's confusing to the user
because they can't see the result of their updating and wonder why they're
not looking at the record they just updated. Is there a way to just requery
just the one record being updated and then remain on that table entry?

Thank you,
Larry B
 
A

Arvin Meyer [MVP]

I'm not sure you can do this with a macro, but it's very easy with VBA code.
Not knowing all your names, I can't write the exact code for you, but I can
tell you how to do it. Aircode follows:

Dim a variable and Set it equal to the current ID of the record you are
writing. Then move to that record after requerying the form.

Sub cmdSave_Click(Cancel As Integer)
Dim lngID As Long
' Requery the form and go to the new record

Me.Requery

Me.RecordsetClone.FindFirst "txtID = " & lngID

If Not Me.RecordsetClone.NoMatch Then
Me.Bookmark = Me.RecordsetClone.Bookmark
End If

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top