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 / Forms Programming / February 2007

Tip: Looking for answers? Try searching our database.

Disable control on exit - Can't disable control that has focus...

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
JBHansen - 15 Feb 2007 21:45 GMT
This is just a minor question, but it's one that has me stumped:

I have a control that I would like to make invisible after the user leaves
it. However, I also know you can't disable a control when it has the focus,
so I can't use the OnExit or OnLostFocus events of this control. Is there a
simple way to do this --- or am I going to have to do it the hard way?

Here's the "hard way" that I've come up with so far: Code a visible=false
into the OnEnter event of all other controls on the form. That seems kind of
clunky, but I haven't come up with anything else that works.

Thanks in advance!
Greg Snidow - 16 Feb 2007 12:29 GMT
Greetings.  This might work for you.Put an unbound text somewhere on the
form, say txtFocus.  Make the back color the same as your form.  Set its
height to .0007.    Then try

Private Sub
YourControl_onLostFocus
  me.txtFocus.setfocus
  me.yourcontrol.visible=false
Exit sub.
I use this for command buttons to disable controls, but I am not sure how a
lostfocus event behaves.

> This is just a minor question, but it's one that has me stumped:
>
[quoted text clipped - 8 lines]
>
> Thanks in advance!
JBHansen - 19 Feb 2007 19:19 GMT
Thanks Greg. We'll give that a try. I'm wondering, though - won't the user
then have to click on their intended destination field, since the focus will
go to txtFocus when they leave? So if they hit the tab button to leave the
initial control, or click on another control and the focus goes to txtFocus,
it might be a little distracting since they expected the cursor to go
somewhere else.

At any rate, we'll see how this works and adjust if necessary.

Thanks again.

> Greetings.  This might work for you.Put an unbound text somewhere on the
> form, say txtFocus.  Make the back color the same as your form.  Set its
[quoted text clipped - 20 lines]
> >
> > Thanks in advance!
 
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.