Solved

Form  --> design tools choose object -- do it in vba while the form is in design mode

Posted on 2016-10-16
2
42 Views
Last Modified: 2016-10-17
Access 2010

Is there a way IN VBA to set focus to a control while the form is in DESIGN MODE?

If a from is in design mode, and you use the ribbon --> "Form Design Tools" /Format   there is an object pull down list that you can find your control and Access will put you on that control (while the form is in design mode) when you pick the control from the list.

Thanks in advance for your help
LJG

------------- The below is not important - but I know you are going to ask why ------------------
I have a tab control with about 25 pages on the control.
                    Tab Fixed Width =0
                    Tab Fixed Height =0
                    Style None
I get to the tabs from buttons on the form

I am redoing most of the pages, where I am moving controls etc to different pages of the controls.
It would be much easier if in code (while the form is in design mode) I could do something like --->   Forms!Tab_1.SetFocus.
Where the tab control name is ---> Tab_Ctl_1    and the pages are --->  Tab_1 /  Tab_2    etc.
0
Comment
Question by:LJG
2 Comments
 
LVL 84

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 500 total points
ID: 41845774
You probably could using the VBE library, but ... by the time you develop and test the code, you will have invested a LOT more time and effort into doing that than you would just doing it manually. I seriously doubt this would be "reusable" code, since you'd have to get pretty specific about control containers, levels, etc etc ... so, again, the ROI would seem to be nonexistent (or even in the negatives, to a very large degree).

I do believe, however, that MZTools has a "Copy Control With Code" feature, which may do what you're after:

www.mztools.com
0
 
LVL 2

Author Comment

by:LJG
ID: 41847094
Thanks Scott

I'll take your advice.  I did add the Object combo to the Quick Access Toolbar.

LJG
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

896 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

19 Experts available now in Live!

Get 1:1 Help Now