Bookmark

  • Thread starter Thread starter Richard
  • Start date Start date
R

Richard

Hi

How do I bookmark a record on a bound form?

This form(A) is not editable and when I want to edit the data, I open
another form(B) to edit it.

Let's say I'm on record 36#. in formA. I click edit and open formB to edit.
I requeried form A when I exit FormB. When FormA activeates it opens at
record#1.

How do I bookmark it so that FormA (after requerying) opens at record#36.

Thanks in advance
Richard
 
The problem is that when you re-query, you loose the bookmarks (they become
invalid).

Also, since you are just opening form b,then why requery, and re-load the
whole form?


Just do a me.refresh on the form a....

Hum, just use the close event of form b...

forms!formA.refresh
 
Hi Albert

Thanks for answering. When I refresh the form, sometimes it doesn't update
the record. Or when I delete or add a new record.

Richard
 
Hi Richard,

What you'll need to do is a bit more complex. Create a variable as a
placeholder, then set it equal to the ID of the record you want to maintain.
Then you can requery and reset the record position to the placeholder
variable. Something like this (aircode):

Sub Event_Click()

Dim lngID As Long ' variable placeholder

lngID = Me.txtID ' ID of record

'... do whatever

Me.Requery

Me.RecordsetClone.FindFirst "ID = " & lngID

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

End Sub
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 
Thanks Arvin

Will try and see...

Richard

Arvin Meyer said:
Hi Richard,

What you'll need to do is a bit more complex. Create a variable as a
placeholder, then set it equal to the ID of the record you want to maintain.
Then you can requery and reset the record position to the placeholder
variable. Something like this (aircode):

Sub Event_Click()

Dim lngID As Long ' variable placeholder

lngID = Me.txtID ' ID of record

'... do whatever

Me.Requery

Me.RecordsetClone.FindFirst "ID = " & lngID

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

End Sub
--
Arvin Meyer, MCP, MVP
Microsoft Access
Free Access downloads:
http://www.datastrat.com
http://www.mvps.org/access
 

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

Back
Top