Solved

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

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

Accepted Solution

by:
Rey Obrero (Capricorn1) 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

Ransomware: The New Cyber Threat & How to Stop It

This infographic explains ransomware, type of malware that blocks access to your files or your systems and holds them hostage until a ransom is paid. It also examines the different types of ransomware and explains what you can do to thwart this sinister online threat.  

Question has a verified solution.

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

Suggested Solutions

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…
Experts-Exchange is a great place to come for help with solutions for your database issues, and many problems are resolved within minutes of being posted.  Others take a little more time and effort and often providing a sample database is very helpf…
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
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…

832 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