Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add new record, requery and go to newly added record

Status
Not open for further replies.

rjstephan

Technical User
Mar 15, 2002
15
US
In a form as you enter new records they are shown in the order entered until you requery or leave and re-enter the form in sorted order. I would like to be able to enter a new record, requery the form and then be taken to the new record in the sorted order. For instance the form is date sorted, I enter a new record with a date that falls somewhere in the middle of the table, I requery to put that new record in its place and the I want to be taken to that new record.
I have done some research on bookmarks, but requery clears the bookmark. I looked at the CurrentRecord property, but that just returns the record number in the record box, and different records could have the same record number depending on the sort. There is apparently a LastModified property for a record (or as a built-in bookmark), but I don't know how to access it.
So if someone could help me build a macro or procedure that would 1) save the new record, 2) get the record's auto-number primary key (which doesn't change), 3) requery the form, and 4) go to that new record in its sorted order -- I would appreciate it.
Thank you.
 
Maybe something like:

intIdent=Me.ID

Docmd.Save
Docmd.Requery

Me.Recordsource = something based around intIdent
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top