Requery form and goto its current record (1 Viewer)

giovi2002

Registered User.
Local time
Today, 09:17
Joined
Apr 12, 2005
Messages
83
I'm requerying a form after an update.

I would like to have the form to be set to its current record when being requeried. How can I easily achieve this?
I've seen things about recordsets, I'm working with ADP (based on SQL Server) and don't know or all DAO events will help me.
 

RuralGuy

AWF VIP
Local time
Today, 10:17
Joined
Jul 2, 2005
Messages
13,826
I could be off base on an ADP but if you are just updating and existing record then I believe Refresh will keep the same current record but refresh the recordset. If you are adding or deleting a record then save a unique value from the current record (PK maybe?) before the Requery. Then do a FindFirst and set the Bookmark to get back to the original current record.
 

giovi2002

Registered User.
Local time
Today, 09:17
Joined
Apr 12, 2005
Messages
83
I'm using bookmark and it works well, until i delete a record.
I requery the recordset in the after delete confirm event.
Within my other event (before update, after update, after insert) i'm using bookmark, but they don't work properly anymore after the delete.
Kinda odd because the requery should also reset the bookmarks (and I explicitly put the value of the bookmark in a variable)
 

RuralGuy

AWF VIP
Local time
Today, 10:17
Joined
Jul 2, 2005
Messages
13,826
Right from VBA help:
Requerying a form invalidates any bookmarks set on records in the form. However, clicking Refresh on the Records menu doesn't affect bookmarks.
As I said earlier, save the PrimaryKey and do a FindFirst to set the bookmark again after the requery.
 

Users who are viewing this thread

Top Bottom