We help IT Professionals succeed at work.

Access 2003 Macro Question:  How to set focus to a specific tab on a tab control within an existing macro?

sah18 asked
Last Modified: 2012-05-05
I am trying to edit an existing Access database macro to include a new item.
I did not create it, and I am not sure how to add to it.
The macro itself appears not in raw code, but in a screen that lists all macros associated with the form.  Here is what is shown:

Macro Name                                  Action
CreateNewContact: On Click        GoToRecord

There is only this one action currently in this macro.
The details for the GoToRecord are as follows:
Object Type:  Form
Object Name:  Contacts
Record:  New

So, currently, when the macro runs, it will place you on a new record in the contact form.

This is what I want, but in addition to this, after placed on the new record, I want to place the user on a specific page on a tab control.

What do I need to add to place them on the page I want in the tab control?
Watch Question

Is this a button in the form that creates a new record?

If so, then What I would do is Create a new Button using the Wizard to "Create new Record"
Then go in and Edit the On Click Event and add to the Code

me.TAB PAGE NAME.setfocus
BTW if the Wizard isn't working for you, the Wizard Generated Code is as follows:
 DoCmd.GoToRecord , , acNewRec


it is a button that already exists on the form, that launches the macro.  I don't really want to re-create the button, as it is already fine the way it is.  I just want to add to the macro code.  Is there a way to have more than one line of code for the macro in that Macros screen that I described above?
Unlock this solution and get a sample of our free trial.
(No credit card required)

Closed, 500 points refunded.
EE Moderator

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.


Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.