473,788 Members | 2,895 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Setting Focus

1. Is there a way to programatically remove the focus from the form; ie, so
the focus is not on any control on the form?

2. Is there a way to programatically set the focus to the same place as is
done when the form opens; ie, the first control in the taborder which is
visible, which is enabled and whose tabstop property is True?

I have a form with forty two small subforms and I want to code the Enter
event of all the subform controls to open a dialog form and when the dialog
form closes, I don't want the focus on any of the forty two subform
controls.

Thanks!

Melissa

Nov 13 '05 #1
5 3784
Melissa wrote:
1. Is there a way to programatically remove the focus from the form; ie, so
the focus is not on any control on the form?

2. Is there a way to programatically set the focus to the same place as is
done when the form opens; ie, the first control in the taborder which is
visible, which is enabled and whose tabstop property is True?

I have a form with forty two small subforms and I want to code the Enter
event of all the subform controls to open a dialog form and when the dialog
form closes, I don't want the focus on any of the forty two subform
controls.


No, something always has to have the focus. You can however use a
transparent button and set the focus to that. A trick here is to use a
normal button and set it's .Transparent property in the open event as
setting it in design mode will make it transparent in design view and
difficult to find on the form :-)

--
This sig left intentionally blank
Nov 13 '05 #2
Trevor,

Thank you for responding and the suggestion for Question 1!

How about Question 2?

Melissa
"Trevor Best" <no****@besty.o rg.uk> wrote in message
news:41******** *************** @news.zen.co.uk ...
Melissa wrote:
1. Is there a way to programatically remove the focus from the form; ie, so the focus is not on any control on the form?

2. Is there a way to programatically set the focus to the same place as is done when the form opens; ie, the first control in the taborder which is
visible, which is enabled and whose tabstop property is True?

I have a form with forty two small subforms and I want to code the Enter
event of all the subform controls to open a dialog form and when the dialog form closes, I don't want the focus on any of the forty two subform
controls.


No, something always has to have the focus. You can however use a
transparent button and set the focus to that. A trick here is to use a
normal button and set it's .Transparent property in the open event as
setting it in design mode will make it transparent in design view and
difficult to find on the form :-)

--
This sig left intentionally blank

Nov 13 '05 #3
Melissa wrote:
Trevor,

Thank you for responding and the suggestion for Question 1!

How about Question 2?


I'm not sure what exactly question 2 is, it looks like you're asking to
do something that is already done: "the first control in the taborder
which is visible, which is enabled and whose tabstop property is True".
Isn't that what happens anyway?

--
This sig left intentionally blank
Nov 13 '05 #4
When the form opens, focus goes to "the first control in the taborder which
is visible, which is enabled and whose tabstop property is True". I'm
looking for a way for Access to identify that control when I click a button
and set focus on it with out my code explicitly specifying that control.

Thanks,

Melissa
"Trevor Best" <no****@besty.o rg.uk> wrote in message
news:41******** *************** @news.zen.co.uk ...
Melissa wrote:
Trevor,

Thank you for responding and the suggestion for Question 1!

How about Question 2?


I'm not sure what exactly question 2 is, it looks like you're asking to
do something that is already done: "the first control in the taborder
which is visible, which is enabled and whose tabstop property is True".
Isn't that what happens anyway?

--
This sig left intentionally blank

Nov 13 '05 #5
Melissa wrote:
When the form opens, focus goes to "the first control in the taborder which
is visible, which is enabled and whose tabstop property is True". I'm
looking for a way for Access to identify that control when I click a button
and set focus on it with out my code explicitly specifying that control.


Ah, I see.

DoCmd.GotoPage 1

should do what you want.

--
This sig left intentionally blank
Nov 13 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
7416
by: Jesper Dannemamm | last post by:
Hi I am having trouble setting focus on I tried using this script in the usercontrol's page_load sub to set focus on a textbox with the ID = "user_name": Page.RegisterStartupScript("focus", "<script language=""JavaScript"">document.getElementById.user_name.focus();</script> ")
20
12308
by: Arne | last post by:
During testing <div style="overflow:auto;"> in CSS I noticed the mousewheel would work in Mozilla only after I made a <a href="#">some text</a> link and clicked on that, within the div. It appears as if Mozilla needs to have the focus set on that div in order for the mousewheel to work. That's all that link does. The mousewheel works perfectly in IE without the link. It scrolls the div even if there is a scrollbar on the page. Is...
0
1774
by: Shravan | last post by:
Hi, I have a Windows Forms Custom DataGrid, which is put in a usercontrol, which on setting DataSource is setting focus to grid. The call stack for setting the focus is as follows. This is not happened always whenever DataSource is set, only called sometimes, in a series of setting DataSource, I could get this setting focus only one time . Can anybody help me how to stop this one. system.windows.forms.dll!
2
7406
by: Mystery Man | last post by:
We have an MDI application that is not setting always setting focus to the newly corrected MDI. It is creating the form and it is the topmost but it does not have focus. The code we are using to activate the MDI is something like the following: frmTest frm = new frmTest(); frm.MdiParent = this; frm.Show();
3
8320
by: Steve Yerkes | last post by:
There seems to be way too much confusion over how to set focus on the a field using a field validator. I looked all over the web and found people trying to do this, but not getting anywhere. There are a couple of people selling components... but that is not really an option for me... So, I took the plunge and modified the "WebUIValidation.js" file to make it happen... After tracing through file, I figure it out. It was actually pretty...
3
5627
by: Brian Henry | last post by:
Hi, I have a bunch of forms in a DLL that I call from my main application. The one form is a login form, and I have the tab order set in the order I want it (password box first, then ok button then cancel button then database selection combo box then user name text box, then back to password text box) now the password, user name and database entry's are in a group box frame. the buttons (Ok and Cancel) are outside the group frame. Now...
1
2063
by: clickon | last post by:
For testing purposes i have got a 2 step WizardControl. Eqach step contains a text box, TextBox1 and TextBox2 respectively. If i put the following code in the respective activate event handlers for the two steps, TextBox1.Text ="foo"; and TextBox2.Text = "bar";
7
8063
by: Zytan | last post by:
I want to set a control in a form to have the default focus. This is not the accept button -- that's set to a button when is 'clicked' when you press ENTER. I want a textbox to have the focus when the form is loaded. The textbox cannot be the first in the Tab order, since it's not at the top of the window, and it seems silly to start the tab order at it just to fix this issue. I cannot call control.Focus() from Form1_Load() since...
5
2040
by: Finn Stampe Mikkelsen | last post by:
Hi How can i set a focus to a textbox in my codebehind page?? I have this WebForm, that takes information from a user and 2 buttons on the form. One that takes action on the entered information and one that resets the form... The second on, the reset button, i would like to set focus back to the first textbox on the form. I already have an onload in my body, which sets the
3
2167
by: kelvin.koogan | last post by:
I have a number of controls on a tab page. I want to validate them all when the user tries to leave the tab. I then want to highlight the first control which fails validation. How can I do this? I try setting focus but something seems to set the focus back to the control which had it before validation. Any ideas? TIA, KK
0
9656
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10173
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10110
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9967
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7517
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5399
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4070
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3674
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.