Solved

How to set focus on a control in subform when opening main form

Posted on 2013-12-02
2
3,505 Views
Last Modified: 2013-12-02
My main form is named [frm_Menu], the subform is named [frm_indtast] and on this subform is a control named [cboFunktion].

I want to set focus on [cboFunktion] when opening [frm_menu]. How?
0
Comment
Question by:LarsDyrby
2 Comments
 
LVL 61

Expert Comment

by:mbizup
ID: 39689583
Try this in the Open Event of your main form:

Me.[frm_indtast].Form.SetFocus 
Me.[frm_indtast].Form.cboFunktion.SetFocus 

Open in new window



Note - If that doesn't work, you may have to replace frm_indtast with the name of your "subform control" if that is different from the name of your subform as seen in the Navigation Pane.  The  "subform control" is the "frame" in your mainform's design that contains your subform (check the Name property by clicking the edge of your subform in your main form's design and bringing up the property sheet)
0
 
LVL 119

Accepted Solution

by:
Rey Obrero earned 500 total points
ID: 39689812
in your form "[frm_indtast]", set the Tab Order so that the combo "[cboFunktion]"  is first on the Custom Order list

in your main form "[frm_Menu]", set the Tab Order so that "frm_indtast" will be on top of the list

No VBA codes needed

but if you want VBA, use

me.[frm_indtast].setfocus
me.[frm_indtast].form.cboFunktion.setfocus
1

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
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 how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…

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

13 Experts available now in Live!

Get 1:1 Help Now