Bookmarking

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi everyone,

I have a subform within a subform on a tabbed form (!) which, after updating
on a different screen I need to requery. At the moment I am doing this in a
macro and it works super, but on requerying the control jumps back to the
first record in the subform (within a subform on a tabbed form). All I want
it to do is return to the last modified record. I know that what I need is
to use the bookmark function or the lastmodified function or both, and
although help makes it clear this can be done, it does not make it clear how
to do it. It seems that requerying will wipe the bookmark anyway, but I have
managed to set up a module function which refreshes the same as hitting
refresh on the toolbar menu. According to help this doesn't wipe out the
bookmark.

Does anyone know how to get access to return to the last modified record, in
a macro or in a module?

Cheers.
 
Sure, You must create a variable to store the record's ID in. Here's some
generic code (unchecked air code) that would demonstrate it:

Sub cmdWhatever_Click()
Dim lngIDHolder As Long

lngIDHolder = Me.txtRecordID

Me. Requery

Me.RecordsetClone. FindFirst "RecordID =" & lngIDHolder
Me.Bookmark = Me.RecordsetClone.Bookmark

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

The active form is FACT FIND which is a tabbed form with various subforms.
The macro runs from a command button on one of the subforms. Its purpose is
to add a new transaction to a client’s record, in this case a mortgage. It
has to first copy the client number into a new transaction record so that the
new transaction will be linked to the client record:

Action Argument Value
GoToControl Control Name: Client No
RunCommand Command: Copy
OpenTable Table Name: Transactions
View: Datasheet
Data Mode: Edit
GoToRecord Object Type: Table
Object Name: Transactions
Record: New
Offset:
GoToControl Control Name: Client No
RunCommand Command: Paste

The next part of the macro uses the sendkeys function:

GoToControl Control Name: Type
SendKeys Keystrokes: MORT
Wait: Yes
Close Object Type: Table
Object Name: Transactions
Save: Yes
Requery Control Name:

I’ve tried some other ways of doing it, such as using the SetValue action,
but I’m having problems getting the macro to find the desired field.

Any further advice would be appreciated.
 
Sorry, just sent the wrong reply to this post, intended for "Sendkeys on
Laptop" - having huge problems trying to post anything today, keep getting
the page cannot be displayed message.

Anyway, with regards to this one, I'm afraid I need a course in Visual Basic
and as yet I don't understand much about code. I'll keep a print and
hopefully this will click into place at some point in the near future.

Thanks.
 

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