Solved

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

Posted on 2013-12-02
2
3,603 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

Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

Question has a verified solution.

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

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…
The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Basics of query design. Shows you how to construct a simple query by adding tables, perform joins, defining output columns, perform sorting, and apply criteria.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

863 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

22 Experts available now in Live!

Get 1:1 Help Now