473,385 Members | 1,712 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,385 software developers and data experts.

How to control unexpected/unwanted GotFocus event property setting (expression)

MLH
A form named frmVehicleEntryForm has a number of textbox
controls who's OnGotFocus property setting is an expression...
=Change2Green()

Change2Green() looks something like this...
Dim MyControl As Control
Set MyControl = Screen.ActiveControl
MyControl.BackColor = 65280

Tabbing from control-to-control is great. Each time I land on
a control, its background turns green making it friendly to use.
LostFocus property setting turns them back to white.

The undesirable behavior is this. I have one control whose dbl-clik
event makes frmVehicleEntryFrom.Visible false and opens another
little Owner Entry Form. When the owner entry form closes and
frmVehicleEntryFrom.Visible is set to True, the form's OwnerID
textbox control (that had the focus when form went invisible)
gets its OnGotFocus event again (dunno how???) and Access 97
complains with a 2474 error, moaning something to the effect that the
"expression I entered requires the control to be in the active
window". What the hell can that possibly mean?

I have verified for sure that the error emanates from running
the above named procedure on that control and that form.
It just happens upon returning to the form. Have no idea why.
The vehicle entry form does not appear to be selected when
the owner entry form closes and the vehicle entry form opens.
Everything looks normal and all is sort-a-paused like its waiting
on me to do something on the form. But when I click on the form
(anywhere) the 2474 error barks out.

I just have to OK the error msg and all goes back to normal.
But its annoying and my target audience isn't gonna wanna
see that msg. Suggestions?
Nov 13 '05 #1
2 3619
On Tue, 07 Jun 2005 23:49:10 -0400, MLH <CR**@NorthState.net> wrote:

Put this as the first line of the ChangeToGreen procedure:
On Error Resume Next 'don't want to hear about possible 2474 error.

The reason OnGotFocus fires again because that control is gaining
focus again - after it was somewhere in OwnerEntryForm.

Adding cuteness to an Access application costs a lot of time. Focus on
functionality.

-Tom.

A form named frmVehicleEntryForm has a number of textbox
controls who's OnGotFocus property setting is an expression...
=Change2Green()

Change2Green() looks something like this...
Dim MyControl As Control
Set MyControl = Screen.ActiveControl
MyControl.BackColor = 65280

Tabbing from control-to-control is great. Each time I land on
a control, its background turns green making it friendly to use.
LostFocus property setting turns them back to white.

The undesirable behavior is this. I have one control whose dbl-clik
event makes frmVehicleEntryFrom.Visible false and opens another
little Owner Entry Form. When the owner entry form closes and
frmVehicleEntryFrom.Visible is set to True, the form's OwnerID
textbox control (that had the focus when form went invisible)
gets its OnGotFocus event again (dunno how???) and Access 97
complains with a 2474 error, moaning something to the effect that the
"expression I entered requires the control to be in the active
window". What the hell can that possibly mean?

I have verified for sure that the error emanates from running
the above named procedure on that control and that form.
It just happens upon returning to the form. Have no idea why.
The vehicle entry form does not appear to be selected when
the owner entry form closes and the vehicle entry form opens.
Everything looks normal and all is sort-a-paused like its waiting
on me to do something on the form. But when I click on the form
(anywhere) the 2474 error barks out.

I just have to OK the error msg and all goes back to normal.
But its annoying and my target audience isn't gonna wanna
see that msg. Suggestions?


Nov 13 '05 #2
MLH
Yes, that did the trick.

Put this as the first line of the ChangeToGreen procedure:
On Error Resume Next 'don't want to hear about possible 2474 error.

The reason OnGotFocus fires again because that control is gaining
focus again - after it was somewhere in OwnerEntryForm.

Adding cuteness to an Access application costs a lot of time. Focus on
functionality.

-Tom.

A form named frmVehicleEntryForm has a number of textbox
controls who's OnGotFocus property setting is an expression...
=Change2Green()

Change2Green() looks something like this...
Dim MyControl As Control
Set MyControl = Screen.ActiveControl
MyControl.BackColor = 65280

Tabbing from control-to-control is great. Each time I land on
a control, its background turns green making it friendly to use.
LostFocus property setting turns them back to white.

The undesirable behavior is this. I have one control whose dbl-clik
event makes frmVehicleEntryFrom.Visible false and opens another
little Owner Entry Form. When the owner entry form closes and
frmVehicleEntryFrom.Visible is set to True, the form's OwnerID
textbox control (that had the focus when form went invisible)
gets its OnGotFocus event again (dunno how???) and Access 97
complains with a 2474 error, moaning something to the effect that the
"expression I entered requires the control to be in the active
window". What the hell can that possibly mean?

I have verified for sure that the error emanates from running
the above named procedure on that control and that form.
It just happens upon returning to the form. Have no idea why.
The vehicle entry form does not appear to be selected when
the owner entry form closes and the vehicle entry form opens.
Everything looks normal and all is sort-a-paused like its waiting
on me to do something on the form. But when I click on the form
(anywhere) the 2474 error barks out.

I just have to OK the error msg and all goes back to normal.
But its annoying and my target audience isn't gonna wanna
see that msg. Suggestions?


Nov 13 '05 #3

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

Similar topics

2
by: Karuppasamy | last post by:
Hi I have created a User Control Containing a Panel and Rich Text Box. The Panel contains some other controls used for formatting the Text entered in the Rich Text Box. My Requirement is...
0
by: Krisa | last post by:
Hello all, I just discovered something (stop me if you've heard this before....) that was causing me a significant performance hit when opening a form with subforms. To speed up loading the...
6
by: Cro | last post by:
Dear Access Developers, The 'Allow Additions' property of my form is causing unexpected results. I am developing a form that has its 'Default View' property set to 'Continuous Forms' and am...
2
by: Stephen Miller | last post by:
Can the CustomValidator be used to simply report unexpected errors, without requiring Client/Server validation? To explain, say you had a simple text box and button that did a Full-text Search of a...
8
by: David Lozzi | last post by:
Howdy, I have a user control that is a report to display data. On the page the control is inserted in, I have filter options to filter the report. When I try to do something like this, nothing...
5
by: Richard Brown | last post by:
Ok, I've been looking through the .NET SDK docs and stuff. I'm wondering if you can provide a control extender that does generic validation or functionality just by dropping it on the form. For...
2
by: bretth | last post by:
In a VB.Net Windows Forms application, I have a user control that handles mouse events. Another section of code programmatically adds a label to the control. I would like label to ignore all...
1
by: mongphong28 | last post by:
Hi, I'm using a treeview as a menu, and when the user clicks on a node I want the focus to set to a control (ie textbox) in a panel to the right. The problem I'm having is the focus will not...
13
by: PW | last post by:
Hi, This is bizarre. I've check and rechecked the spelling, cut and paste the name of the form (when trying to rename the form) and the control yet I still get a parameter prompt when the form...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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,...
0
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...

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.