?
Solved

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

Posted on 2013-12-02
2
Medium Priority
?
4,015 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 2000 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

752 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