FindRecord Feature

J

John

I have a form that pops up a subform to enter extra detail
for the record on the main form. Once I am done with
entering the extra data, I requery the main form in order
for the records to update on the screen. The problem is
the record that I edited is not selected anymore. Is
there anyway to reselect the record that I was on before.

Thanks,
John
 
M

Michel Walsh

Hi,


You have to store the "key" value in a variable before you requery.
Indeed, LastModified is a bookmark, but would be invalid after the requery.
So, if you do not requery:


Me.Bookmark = Me.RecordsetClone.LastModified


would do. But with a requery, something like :

Dim pk As Long
pk=primaryKeyFieldValue
Me.Requery
Me.RecordsetClone.FindFirst "PrimaryKeyField=" & pk
Me.Bookmark = Me.RecordsetClone.Bookmark


should do. I assumed the primary key value was numerical (long integer).




Hoping it may help,
Vanderghast, Access MVP
 

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