Solved

How do I remove the focus off a control through a macro so that I can hide it?

Posted on 2008-10-05
2
241 Views
Last Modified: 2013-11-28
I have a macro that hides a number of controls after clicking a control called cmdLogout. However, I want cmdLogout to also hide as the macro executes. But this brings up an error because it cannot hide a control that has the focus. How do i remove the focus from the control so that it can be hidden?
0
Comment
Question by:Anneline
2 Comments
 
LVL 33

Accepted Solution

by:
Mike Eghtebas earned 500 total points
ID: 22647093
On your form add a text box (txtDummy). It remains unbound (nothing in its control soutce), width = 0.

In Gotfocus event of txtDummy have:

txtName.visible = false
.
.
.
cmdLogout.visible = false
etc.

And in Click event of cmdLogout have:

Sub cmdLogout_Click()
.
.your existing code
.

Me!txtDummy.SetFocus
End Sub

Mike
0
 

Author Closing Comment

by:Anneline
ID: 31503296
Thanks!
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

In the article entitled Working with Objects – Part 1 (http://www.experts-exchange.com/Microsoft/Development/MS_Access/A_4942-Working-with-Objects-Part-1.html), you learned the basics of working with objects, properties, methods, and events. In Work…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now