473,804 Members | 3,088 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

which control has the focus

Hi all,
Ive got a form with several controls which contain date fields. I'm usng the
activex calender control as a separate floating form, I would like to be
able to click onto any of the date fields and use the calender to drop a
date into it.

So far, I've managed to drop the date selected from the calener, into a
specified control, and requery the control to display the newly added date.
Works fine using the rs object.

However what i need to know is the name of the currently selected control
and field, then I can tell the calender control exactly what to do. I've
tried the screen.previous control, and this works fine when I open the
calender, but I can't get it to work when I simply switch focus to a new
date control, and try to use the calender again.

Am i on the right track for a solution.

Thanks

Gerry Abbott


Nov 13 '05 #1
7 4465
MA

"Gerry Abbott" <pl****@ask.i e> ha scritto nel messaggio
news:tk******** ***********@new s.indigo.ie...
Hi all,
Ive got a form with several controls which contain date fields. I'm usng the activex calender control as a separate floating form, I would like to be
able to click onto any of the date fields and use the calender to drop a
date into it.

So far, I've managed to drop the date selected from the calener, into a
specified control, and requery the control to display the newly added date. Works fine using the rs object.

However what i need to know is the name of the currently selected control
and field, then I can tell the calender control exactly what to do. I've
tried the screen.previous control, and this works fine when I open the
calender, but I can't get it to work when I simply switch focus to a new
date control, and try to use the calender again.

Am i on the right track for a solution.

Thanks

Gerry Abbott

Save the name of screen.activeco ntrol in a varible of the form
Declare it on the top of the module
Dim ControlToRememb er as string
when you need you save it

ControlToRememb er = screen.activeco ntrol.name
After used remember to clean it
MAssimiliano
Nov 13 '05 #2
Sounds good.
But probably have to declare it as public, in order to use it in the second
(calender) form.
Thanks.

"MA" <ma****@massimi lianoamendola.i t> wrote in message
news:J6******** ***********@new s.edisontel.com ...

"Gerry Abbott" <pl****@ask.i e> ha scritto nel messaggio
news:tk******** ***********@new s.indigo.ie...
Hi all,
Ive got a form with several controls which contain date fields. I'm usng

the
activex calender control as a separate floating form, I would like to be
able to click onto any of the date fields and use the calender to drop a
date into it.

So far, I've managed to drop the date selected from the calener, into a
specified control, and requery the control to display the newly added

date.
Works fine using the rs object.

However what i need to know is the name of the currently selected control
and field, then I can tell the calender control exactly what to do. I've
tried the screen.previous control, and this works fine when I open the
calender, but I can't get it to work when I simply switch focus to a new
date control, and try to use the calender again.

Am i on the right track for a solution.

Thanks

Gerry Abbott

Save the name of screen.activeco ntrol in a varible of the form
Declare it on the top of the module
Dim ControlToRememb er as string
when you need you save it

ControlToRememb er = screen.activeco ntrol.name
After used remember to clean it
MAssimiliano

Nov 13 '05 #3
No, that did not work, so had to declare it in a standard module as a public
variable. That way it can be seen from all class modules.
"Gerry Abbott" <pl****@ask.i e> wrote in message
news:pu******** ***********@new s.indigo.ie...
Sounds good.
But probably have to declare it as public, in order to use it in the
second (calender) form.
Thanks.

"MA" <ma****@massimi lianoamendola.i t> wrote in message
news:J6******** ***********@new s.edisontel.com ...

"Gerry Abbott" <pl****@ask.i e> ha scritto nel messaggio
news:tk******** ***********@new s.indigo.ie...
Hi all,
Ive got a form with several controls which contain date fields. I'm usng

the
activex calender control as a separate floating form, I would like to be
able to click onto any of the date fields and use the calender to drop a
date into it.

So far, I've managed to drop the date selected from the calener, into a
specified control, and requery the control to display the newly added

date.
Works fine using the rs object.

However what i need to know is the name of the currently selected
control
and field, then I can tell the calender control exactly what to do. I've
tried the screen.previous control, and this works fine when I open the
calender, but I can't get it to work when I simply switch focus to a new
date control, and try to use the calender again.

Am i on the right track for a solution.

Thanks

Gerry Abbott

Save the name of screen.activeco ntrol in a varible of the form
Declare it on the top of the module
Dim ControlToRememb er as string
when you need you save it

ControlToRememb er = screen.activeco ntrol.name
After used remember to clean it
MAssimiliano


Nov 13 '05 #4
I'm still struggling.
My problem is with the ActiveControl object.
Ive tried to return the name from the Activate, Current, and Got Focus
events but without success. I have managed to do it with the click on a
button control, but that's too late for what I require. I need to return
this value as soon a the user clicks anywhere on the subform.
What event should I use to return this, so that when i click on the control
it returns the current control name in this way ?

Thanks in advance.

Gerry Abbot

"Gerry Abbott" <pl****@ask.i e> wrote in message
news:oH******** ***********@new s.indigo.ie...
No, that did not work, so had to declare it in a standard module as a
public variable. That way it can be seen from all class modules.
"Gerry Abbott" <pl****@ask.i e> wrote in message
news:pu******** ***********@new s.indigo.ie...
Sounds good.
But probably have to declare it as public, in order to use it in the
second (calender) form.
Thanks.

"MA" <ma****@massimi lianoamendola.i t> wrote in message
news:J6******** ***********@new s.edisontel.com ...

"Gerry Abbott" <pl****@ask.i e> ha scritto nel messaggio
news:tk******** ***********@new s.indigo.ie...
Hi all,
Ive got a form with several controls which contain date fields. I'm
usng
the
activex calender control as a separate floating form, I would like to
be
able to click onto any of the date fields and use the calender to drop
a
date into it.

So far, I've managed to drop the date selected from the calener, into a
specified control, and requery the control to display the newly added
date.
Works fine using the rs object.

However what i need to know is the name of the currently selected
control
and field, then I can tell the calender control exactly what to do.
I've
tried the screen.previous control, and this works fine when I open the
calender, but I can't get it to work when I simply switch focus to a
new
date control, and try to use the calender again.

Am i on the right track for a solution.

Thanks

Gerry Abbott

Save the name of screen.activeco ntrol in a varible of the form
Declare it on the top of the module
Dim ControlToRememb er as string
when you need you save it

ControlToRememb er = screen.activeco ntrol.name
After used remember to clean it
MAssimiliano



Nov 13 '05 #5
try PreviousControl insead of ActiveControl

HTH
Paul

"Gerry Abbott" <pl****@ask.i e> wrote in message
news:Hm******** ***********@new s.indigo.ie...
I'm still struggling.
My problem is with the ActiveControl object.
Ive tried to return the name from the Activate, Current, and Got Focus
events but without success. I have managed to do it with the click on a
button control, but that's too late for what I require. I need to return
this value as soon a the user clicks anywhere on the subform.
What event should I use to return this, so that when i click on the
control it returns the current control name in this way ?

Thanks in advance.

Gerry Abbot

"Gerry Abbott" <pl****@ask.i e> wrote in message
news:oH******** ***********@new s.indigo.ie...
No, that did not work, so had to declare it in a standard module as a
public variable. That way it can be seen from all class modules.
"Gerry Abbott" <pl****@ask.i e> wrote in message
news:pu******** ***********@new s.indigo.ie...
Sounds good.
But probably have to declare it as public, in order to use it in the
second (calender) form.
Thanks.

"MA" <ma****@massimi lianoamendola.i t> wrote in message
news:J6******** ***********@new s.edisontel.com ...

"Gerry Abbott" <pl****@ask.i e> ha scritto nel messaggio
news:tk******** ***********@new s.indigo.ie...
> Hi all,
> Ive got a form with several controls which contain date fields. I'm
> usng
the
> activex calender control as a separate floating form, I would like to
> be
> able to click onto any of the date fields and use the calender to drop
> a
> date into it.
>
> So far, I've managed to drop the date selected from the calener, into
> a
> specified control, and requery the control to display the newly added
date.
> Works fine using the rs object.
>
> However what i need to know is the name of the currently selected
> control
> and field, then I can tell the calender control exactly what to do.
> I've
> tried the screen.previous control, and this works fine when I open the
> calender, but I can't get it to work when I simply switch focus to a
> new
> date control, and try to use the calender again.
>
> Am i on the right track for a solution.
>
> Thanks
>
> Gerry Abbott
>
Save the name of screen.activeco ntrol in a varible of the form
Declare it on the top of the module
Dim ControlToRememb er as string
when you need you save it

ControlToRememb er = screen.activeco ntrol.name
After used remember to clean it
MAssimiliano



Nov 13 '05 #6
Could not get either the active control or the pastcontrol objects to work
satisfactorily.

Ok Here's a solution, but it does not involve activecontrol.

I placed a reference unbound, invisible control on the main form. On the
click event of the subforms and their controls, I used the parent property
to write into this invisible control. What is written in, depending on Which
subform is doing the writing.

Then on pop up, just referenced the value in this control, and took action
appropriate to that value.

Gerry

"Paul" <pz****@rogers. com> wrote in message
news:pI******** ************@ro gers.com...
try PreviousControl insead of ActiveControl

HTH
Paul

"Gerry Abbott" <pl****@ask.i e> wrote in message
news:Hm******** ***********@new s.indigo.ie...
I'm still struggling.
My problem is with the ActiveControl object.
Ive tried to return the name from the Activate, Current, and Got Focus
events but without success. I have managed to do it with the click on a
button control, but that's too late for what I require. I need to return
this value as soon a the user clicks anywhere on the subform.
What event should I use to return this, so that when i click on the
control it returns the current control name in this way ?

Thanks in advance.

Gerry Abbot

"Gerry Abbott" <pl****@ask.i e> wrote in message
news:oH******** ***********@new s.indigo.ie...
No, that did not work, so had to declare it in a standard module as a
public variable. That way it can be seen from all class modules.
"Gerry Abbott" <pl****@ask.i e> wrote in message
news:pu******** ***********@new s.indigo.ie...
Sounds good.
But probably have to declare it as public, in order to use it in the
second (calender) form.
Thanks.

"MA" <ma****@massimi lianoamendola.i t> wrote in message
news:J6******** ***********@new s.edisontel.com ...
>
> "Gerry Abbott" <pl****@ask.i e> ha scritto nel messaggio
> news:tk******** ***********@new s.indigo.ie...
>> Hi all,
>> Ive got a form with several controls which contain date fields. I'm
>> usng
> the
>> activex calender control as a separate floating form, I would like to
>> be
>> able to click onto any of the date fields and use the calender to
>> drop a
>> date into it.
>>
>> So far, I've managed to drop the date selected from the calener, into
>> a
>> specified control, and requery the control to display the newly added
> date.
>> Works fine using the rs object.
>>
>> However what i need to know is the name of the currently selected
>> control
>> and field, then I can tell the calender control exactly what to do.
>> I've
>> tried the screen.previous control, and this works fine when I open the
>> calender, but I can't get it to work when I simply switch focus to a
>> new
>> date control, and try to use the calender again.
>>
>> Am i on the right track for a solution.
>>
>> Thanks
>>
>> Gerry Abbott
>>
> Save the name of screen.activeco ntrol in a varible of the form
> Declare it on the top of the module
>
>
> Dim ControlToRememb er as string
>
>
> when you need you save it
>
> ControlToRememb er = screen.activeco ntrol.name
> After used remember to clean it
> MAssimiliano
>
>



Nov 13 '05 #7
rkc

"Gerry Abbott" <pl****@ask.i e> wrote in message
news:tk******** ***********@new s.indigo.ie...
Hi all,
Ive got a form with several controls which contain date fields. I'm usng the activex calender control as a separate floating form, I would like to be
able to click onto any of the date fields and use the calender to drop a
date into it.


<snip snip snip>

Pass the control name to the calendar form as the openargs parameter of
a DoCmd.Openform call and set the passed in control's value in the calendar
control's click event. I'm too lazy to try it at the moment but I don't
think
it matters if the calendar form is already open.

I usually do this with a class using WithEvents that opens a calendar form
when a textbox is either double clicked or ctrl-C is pressed. The big
difference is the calendar form isn't left floating around, it's opened when
needed. The calendar isn't opened OnEnter in case the user just wants
to go ahead and type in the date.



Nov 13 '05 #8

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

Similar topics

2
28810
by: Liam McNamara | last post by:
I am having the same problem as the one I found in google below: http://groups.google.com/groups?hl=en&lr=&ie=UTF-8&oe=UTF-8&threadm=%23LO32NWECHA.1968%40tkmsftngp02&rnum=3&prev=/groups%3Fq%3Dc%2523%2Bwhich%2Bcontrol%2Bhas%2Bfocus%26hl%3Den%26lr%3D%26ie%3DUTF-8%26oe%3DUTF-8%26selm%3D%2523LO32NWECHA.1968%2540tkmsftngp02%26rnum%3D3 I need to determine which component has focus. When I select from the main menu File->Save my validation is...
2
5192
by: Marco Liedekerken | last post by:
Hi, Is it possible to retrieve the control that had the focus when the page was posted back? Because the focus is lost when a postback occurs I want to manually set the focus to the control that previously had the focus (smartnavigation doesn't do the trick). Thanks, Marco
2
2157
by: bill | last post by:
I have the following user control in my project simply for setting focus to a control: Public Class SetFocus Inherits System.Web.UI.UserControl
3
1092
by: julien | last post by:
Hi, after the OnCLick event, when I am in the function that deal with the event, I want to retrieve the control that had the focus on the page? How can I do this please? Thanks in advance. JULIEN
2
8376
by: Tom | last post by:
I am developing a VB.NET user control that is composed of a component control (along with some classes, etc). This is probably a stupid question, and should be easy, but I must be having a brain fart. In the control itself, how do I set focus BACK to the form that the control is on? This control does some maniuplation of an outside application (by starting up the application and sending it keystrokes). What I want to be able to do is to...
0
1714
by: Nick | last post by:
I have a situation wherein i have a text box, that has abc() being executed whenever the lost focus event is triggered. However, there is an exceptional case where, if a button click causes the lost focus, I do not want abc() to be called. Is there a method by which one can find out which control is triggering the lost focus event? I have a keyboard shortcut for the click handle, and the lost focus handle does not get invoked if I use...
1
5141
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";
9
18024
by: Zytan | last post by:
http://msdn2.microsoft.com/en-us/system.windows.forms.control.focus(VS.80).aspx this page says: "Focus is a low-level method intended primarily for custom control authors. Instead, application programmers should use the Select method or the ActiveControl property for child controls, or the Activate method for forms." I am trying to give a Numeric UpDown control focus. Only Focus() works. But this says to not use it.
3
2143
by: Nathan Laff | last post by:
I have a custom Control that is a label, however I inherit from Control... 1) I override onClick and do a DrawFocusRectangle, that works great. How do I clear the focus rectangle once something else on the parent is clicked? I tried to override OnLostFocus and invalidate but that doesn't seem to do it. 2) the control, like i said is a label, how do i override the hotkey behavior. I.e, if my text is &Help, when I do Alt-H on the parent,...
0
10564
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10308
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
10073
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
7609
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
6846
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5513
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...
0
5645
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4288
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
3806
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.