Solved

How can I stop a combo box flickering when the On GotFocus event fires?

Posted on 2014-09-11
6
277 Views
Last Modified: 2014-09-13
I have a combo box with an On GotFocus event that simply does a me.activecontrol.requery. The intention is to refresh the rowsource of the list before the user makes a selection. Whenever I click on the combo box of a new record the list briefly appears then disappears. I then need to click a second time to bring up the list. Is there any way to requery the rowsource without having the list appear and disappear?
0
Comment
Question by:Rob4077
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 85

Accepted Solution

by:
Scott McDaniel (Microsoft Access MVP - EE MVE ) earned 250 total points
ID: 40317013
Are you sure you need to requery the control that often? If you're adding records that could affect the data displayed in the control, then you might be better off requerying the control when you finish that process (i.e. when you finish adding the data).

That said, you can always try turning off the Echo:

Application.Echo False
<do your work>
Application.Echo True

If that doesn't work you can use the API:

Put this in the General Declarations section of a Standard Module (i.e. NOT a form):

Declare Function LockWindowUpdate Lib "user32" (ByVal hWnd As Long) As Long

Now call it when needed:

LockWindowUpdate Me.Hwnd
<do your work>
LockWindowUpdate 0

Just be SURE that nothing interferes with the "LockWindowUpdate 0" line. If your code fails before that line, the application will appear to hang, since Windows will stop updating the display. Same with the Echo methods - if you fail to run Echo back on, the application will appear to hang.
0
 
LVL 10

Assisted Solution

by:WayneATaylor
WayneATaylor earned 250 total points
ID: 40317099
The problem with a requery is it will always clear the list then re populate it.

Rather than requery on getfocus, can you do the requery say when another field is updated or even on a timer?

Making sure to add code to not requery if the combo list is open.

Thanks
Wayne
0
 

Author Comment

by:Rob4077
ID: 40318780
Thanks for your suggestions.  I had hoped there was another way but I will find a way to make it work as you suggest.
0
PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

 
LVL 85
ID: 40319001
What was the solution for this?
0
 

Author Comment

by:Rob4077
ID: 40320696
For me the easiest solution was the one you both suggested: "you might be better off requerying the control when you finish that process" and "requery say when another field is updated ". I am requerying the controls whenever a change is made to the source data instead of when the control is selected. That's why I shared points. Thanks
0
 

Author Comment

by:Rob4077
ID: 40320697
BTW I tried the echo command but it didn't stop the flicker.
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s been over a month into 2017, and there is already a sophisticated Gmail phishing email making it rounds. New techniques and tactics, have given hackers a way to authentically impersonate your contacts.How it Works The attack works by targeti…
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

688 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