469,925 Members | 1,491 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,925 developers. It's quick & easy.

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.previouscontrol, 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 4272
MA

"Gerry Abbott" <pl****@ask.ie> ha scritto nel messaggio
news:tk*******************@news.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.previouscontrol, 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.activecontrol in a varible of the form
Declare it on the top of the module
Dim ControlToRemember as string
when you need you save it

ControlToRemember = screen.activecontrol.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****@massimilianoamendola.it> wrote in message
news:J6*******************@news.edisontel.com...

"Gerry Abbott" <pl****@ask.ie> ha scritto nel messaggio
news:tk*******************@news.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.previouscontrol, 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.activecontrol in a varible of the form
Declare it on the top of the module
Dim ControlToRemember as string
when you need you save it

ControlToRemember = screen.activecontrol.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.ie> wrote in message
news:pu*******************@news.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****@massimilianoamendola.it> wrote in message
news:J6*******************@news.edisontel.com...

"Gerry Abbott" <pl****@ask.ie> ha scritto nel messaggio
news:tk*******************@news.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.previouscontrol, 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.activecontrol in a varible of the form
Declare it on the top of the module
Dim ControlToRemember as string
when you need you save it

ControlToRemember = screen.activecontrol.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.ie> wrote in message
news:oH*******************@news.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.ie> wrote in message
news:pu*******************@news.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****@massimilianoamendola.it> wrote in message
news:J6*******************@news.edisontel.com...

"Gerry Abbott" <pl****@ask.ie> ha scritto nel messaggio
news:tk*******************@news.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.previouscontrol, 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.activecontrol in a varible of the form
Declare it on the top of the module
Dim ControlToRemember as string
when you need you save it

ControlToRemember = screen.activecontrol.name
After used remember to clean it
MAssimiliano



Nov 13 '05 #5
try PreviousControl insead of ActiveControl

HTH
Paul

"Gerry Abbott" <pl****@ask.ie> wrote in message
news:Hm*******************@news.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.ie> wrote in message
news:oH*******************@news.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.ie> wrote in message
news:pu*******************@news.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****@massimilianoamendola.it> wrote in message
news:J6*******************@news.edisontel.com...

"Gerry Abbott" <pl****@ask.ie> ha scritto nel messaggio
news:tk*******************@news.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.previouscontrol, 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.activecontrol in a varible of the form
Declare it on the top of the module
Dim ControlToRemember as string
when you need you save it

ControlToRemember = screen.activecontrol.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********************@rogers.com...
try PreviousControl insead of ActiveControl

HTH
Paul

"Gerry Abbott" <pl****@ask.ie> wrote in message
news:Hm*******************@news.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.ie> wrote in message
news:oH*******************@news.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.ie> wrote in message
news:pu*******************@news.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****@massimilianoamendola.it> wrote in message
news:J6*******************@news.edisontel.com...
>
> "Gerry Abbott" <pl****@ask.ie> ha scritto nel messaggio
> news:tk*******************@news.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.previouscontrol, 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.activecontrol in a varible of the form
> Declare it on the top of the module
>
>
> Dim ControlToRemember as string
>
>
> when you need you save it
>
> ControlToRemember = screen.activecontrol.name
> After used remember to clean it
> MAssimiliano
>
>



Nov 13 '05 #7
rkc

"Gerry Abbott" <pl****@ask.ie> wrote in message
news:tk*******************@news.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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Liam McNamara | last post: by
2 posts views Thread by Marco Liedekerken | last post: by
2 posts views Thread by bill | last post: by
3 posts views Thread by julien | last post: by
1 post views Thread by clickon | last post: by
3 posts views Thread by Nathan Laff | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.