[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1273
  • Last Modified:

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

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?
  • 2
  • 2
1 Solution
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
sah18Author Commented:
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?
sah18Author Commented:
Ahhh, I solved this myself.  In case others need to do this:
Just add an additional row beneath the previous action.
Select "GoToControl", and then type in the TabPage name in the control text box.
Closed, 500 points refunded.
EE Moderator

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now