Wrox Programmer Forums
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old September 9th, 2005, 10:18 AM
Friend of Wrox
 
Join Date: Jun 2005
Posts: 181
Thanks: 0
Thanked 0 Times in 0 Posts
Default Set Focus on a Sub Form

Help Required again
I need to set focus on a field on the sub form which sits on the main form.I have setup on the sub form that when the form loads this field has the focus.This does not work when it sits as a main form Help needed

Thanks
Brendan

Brendan Bartley
__________________
Brendan Bartley
 
Old September 9th, 2005, 10:21 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 471
Thanks: 0
Thanked 1 Time in 1 Post
Default

Brendan,

Do you have any fields on the main form? If you do, the focus will always set to the main form first. If you don't want this to happen, you'll have to set the focus yourself.

Let me know, and I'll tell you how.

Kevin

dartcoach
 
Old September 9th, 2005, 10:26 AM
Friend of Wrox
 
Join Date: Jun 2005
Posts: 181
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yes I need help to do this set focus on the sub form

Brendan Bartley
 
Old September 9th, 2005, 10:30 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 471
Thanks: 0
Thanked 1 Time in 1 Post
Default

Brendan,

When you open the main form, you ALWAYS want to set the focus to the subform?

If so, in the on open event of the main form, put:

me.subformname.setfocus

This should set the focus to the subform, which then the field you want to have the focus should have it. If not, change the code to:

me.subformname.subformfieldname.setfocus

Kevin

dartcoach
 
Old September 9th, 2005, 10:35 AM
Friend of Wrox
 
Join Date: Jan 2005
Posts: 471
Thanks: 0
Thanked 1 Time in 1 Post
Default

Brendan,

Sorry, the second code should be:

me.subformname.form.subformfieldname.setfocus

Kevin

dartcoach
 
Old September 9th, 2005, 10:49 AM
Friend of Wrox
 
Join Date: Jun 2005
Posts: 181
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Excellent thanks Kevin

Brendan Bartley





Similar Threads
Thread Thread Starter Forum Replies Last Post
set focus sameer_1981 Intro Programming 1 February 27th, 2007 09:14 AM
set Focus to web control in Web form vivekshah C# 1 June 17th, 2006 03:25 AM
set focus akibaMaila VB.NET 2002/2003 Basics 1 July 12th, 2005 05:56 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.