Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / General 1 / November 2004

Tip: Looking for answers? Try searching our database.

which control has the focus

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Gerry Abbott - 10 Nov 2004 10:47 GMT
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
MA - 10 Nov 2004 12:48 GMT
> Hi all,
> Ive got a form with several controls which contain date fields. I'm usng the
[quoted text clipped - 17 lines]
>
> 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
Gerry Abbott - 10 Nov 2004 15:30 GMT
Sounds good.
But probably have to declare it as public, in order to use it in the second
(calender) form.
Thanks.

>> Hi all,
>> Ive got a form with several controls which contain date fields. I'm usng
[quoted text clipped - 30 lines]
> After used remember to clean it
> MAssimiliano
Gerry Abbott - 10 Nov 2004 15:44 GMT
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.

> Sounds good.
> But probably have to declare it as public, in order to use it in the
[quoted text clipped - 36 lines]
>> After used remember to clean it
>> MAssimiliano
Gerry Abbott - 10 Nov 2004 16:30 GMT
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

> 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.
[quoted text clipped - 44 lines]
>>> After used remember to clean it
>>> MAssimiliano
Paul - 10 Nov 2004 17:05 GMT
try PreviousControl insead of ActiveControl

HTH
Paul

> I'm still struggling.
> My problem is with the ActiveControl object.
[quoted text clipped - 58 lines]
>>>> After used remember to clean it
>>>> MAssimiliano
Gerry Abbott - 10 Nov 2004 21:48 GMT
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

> try PreviousControl insead of ActiveControl
>
[quoted text clipped - 63 lines]
>>>>> After used remember to clean it
>>>>> MAssimiliano
rkc - 10 Nov 2004 23:13 GMT
> 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.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.