Solved

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

Posted on 2014-02-12
2
705 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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

708 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now