473,322 Members | 1,480 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Can't get ActiveControl from Form_Current event

When I run the following code from a continuous form's Current event:
Set ctrl = Me.ActiveControl
I get an error 2474 - 'The expression you entered requires the control to be
in the active window'.
I've tested it in simple (1 field) forms with no other code, and get the
same result.
Is it not possible to get this value from the Form_Current event?
Screen.ActiveControl gives the same result.

--
Bob Darlington
Brisbane
Oct 23 '06 #1
2 6276
At the moment that the Form_Current event is raised, no control has the
focus. So, to answer your question, it is not possible to capture this
value within the Form_Current event.

"Bob Darlington" <bo*@dpcmanAX.com.auwrote in message
news:45***********************@news.optusnet.com.a u...
When I run the following code from a continuous form's Current event:
Set ctrl = Me.ActiveControl
I get an error 2474 - 'The expression you entered requires the control to
be
in the active window'.
I've tested it in simple (1 field) forms with no other code, and get the
same result.
Is it not possible to get this value from the Form_Current event?
Screen.ActiveControl gives the same result.

--
Bob Darlington
Brisbane


Oct 23 '06 #2
Thanks for the reply.
I think I was coming to that conclusion, but I saw a number of references to
using it in the Current event from posters with some standing in this NG.

--
Bob Darlington
Brisbane
"ByteMyzer" <sb*@news.sf.sbcglobal.netwrote in message
news:PG**************@newssvr11.news.prodigy.com.. .
At the moment that the Form_Current event is raised, no control has the
focus. So, to answer your question, it is not possible to capture this
value within the Form_Current event.

"Bob Darlington" <bo*@dpcmanAX.com.auwrote in message
news:45***********************@news.optusnet.com.a u...
>When I run the following code from a continuous form's Current event:
Set ctrl = Me.ActiveControl
I get an error 2474 - 'The expression you entered requires the control to
be
>in the active window'.
I've tested it in simple (1 field) forms with no other code, and get the
same result.
Is it not possible to get this value from the Form_Current event?
Screen.ActiveControl gives the same result.

--
Bob Darlington
Brisbane



Oct 23 '06 #3

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

Similar topics

2
by: Barry Edmund Wright | last post by:
Hi, On the form's AfterUpdate event (Form_AfterUpdate) I want to determine what field on the form my cursor is on. If the cursor is on Field1 I want to do something, if it is on Field2 I want...
0
by: Greg | last post by:
I'd like to know which contol the focus of a cell in a datagrid is being lost to. Querying ActiveControl.Name within the LostFocus event gives me a blank string, instead of the name of a button I...
2
by: Steve Richfie1d | last post by:
In Access 97, in the Form_Current routine of a form, I call another routine that repopulates and recomputes everything. However, a SQL Select statement that I initiate from DAO that refers to a...
4
by: Aphazel | last post by:
I got serveral textboxes in a form and want to copy/cut/paste text to clipboard from currently selected (focused) textbox. It's simple to cut/copy/paste when using specified control directly ie...
3
by: sparks | last post by:
I have 2 fields that I have to make sure don't get screwed up. (could be one it doesn't matter) but what they want is no duplicates, warn the user changing existing numbers is a no no. (of course...
0
by: Rick Shaw | last post by:
Hi, I need to determine if the current ActiveControl is ReadOnly. I need to find this out in the Form's keypress event. How do I go about doing this? Also, I have a control this is a...
1
by: unknown; | last post by:
hello, i've got a question about active control. i'm buillding an application witch uses me.activeControl a few times to check some things. Now something strange happends.. when i click on...
5
by: questionit | last post by:
Hi I am finding it difficult to use Form_Current() event of a subform. It gets called automatically. I changed the tab order so that the Sub Form with Form_Current() event came first or in the...
3
by: nano2k | last post by:
Each form has its ActiveControl property, but no ActiveControlChanged event to signal that the active control has changed (like ParentChanged event). I tried to trick the form by declaring this...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...

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.