Solved

vba to go to the record on a form with vba on microsoft access 2013

Posted on 2014-02-12
2
715 Views
Last Modified: 2014-02-12
hi

i have some weird problem, when i use vba on form1 for example to add a value on form2.childform and then i use vba to  close form1 and to go to the new value on form2.childform, but in stead it's after closing  form2 -  the focus is  on the first record on form2.childform and not the last (and new) record


there is my code

        Forms!form2.Refresh
        DoEvents
        DoCmd.GoToRecord , , aclast

Open in new window

0
Comment
Question by:bill201
2 Comments
 
LVL 57

Accepted Solution

by:
Jim Dettman (Microsoft MVP/ EE MVE) earned 500 total points
ID: 39853033
Not sure I understand the question, but typically you want to record position by passing a flag to a form, then let it position once it's populated it's recordset.

The other is your DoEvents.   It's really not what you want if your trying to let Access/JET catch up on operations.  Instead, use:

dbEngine.Idle   to let JET catch up on record operations

and

.Repaint to force forms to finish any pending operations.

 DoEvents gives up processing time to the OS.  You want to use that when working with OLE automation, external files, etc.   In other words when you want to give time to things outside of Access.

Jim.
0
 

Author Closing Comment

by:bill201
ID: 39853056
thanks a lot for your excellent answer
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Any Way to Print an Import Spec? 3 29
Should I keep recordsets open? 3 23
Update a text value in another table 10 39
Why get error when delete all records on a sub-form 2 15
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question