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

Conditional Formatting on a Combo Box

mjoachim
Hello Everyone!

I have a continuous form that is used to enter time data. I have a couple fields, such as employee number, that are Combo Boxes. The user is able to enter an employee number that is not in the employee table, so in that situation, I set a conditional format to change the control red to indicate the absence of that number.

My problem seems to be the timing of the many calculations occurring...The conditional formatting is taking just long enough to occur that if I use the drop down list of the combo box, the formatting often occurs after I've expanded the list, which then minimizes it on me.

Any thoughts on why the formatting is taking so long to occur, or suggestions of other ways that I could format the control conditionally that won't impact my ability to use the combo box drop down?

I've tried using VBA code to accomplish this, but my approach highlights the selected control of every record on the continuous form, not just the non-matching record. Is there a piece of code that I should be using to work with just the active record?

Thanks for any help!
Aug 12 '15 #1
4 2873
dsatino
393 256MB
go into design view, right click the field, and look for conditional formatting. From there, just build the expression.
Aug 12 '15 #2
Rabbit
12,516 Expert Mod 8TB
Dsatino, I believe they have already done that. The issue is that they're having performance problems.

Mjoachim, what is the expression you're using? That's the most likely cause of the performance issue. I assume you're using a domain lookup function? Those can be very computationally expensive.
Aug 12 '15 #3
jforbes
1,107 Expert 1GB
You have already figured out that if using a Continuous Form, setting the background color of the Control changes the background color for every instance of that Control and not just the Current Record. So for Continuous Forms, you have to use Conditional Formatting.

The Evaluation of the Conditional Formatting takes place after all the Data is retrieved and displayed to the User as well as all Calculated fields are calculated and displayed. So it's about one of the last things that is done. Not only is it done last, in my experience, it is done in a separate thread that the main thread, so the UI is returned to the User, before the screen has been fully updated.

The first thing I would try is to see if there is anything to be done to speed up the Expression that is being evaluated as the amount of time this takes to apply the formatting is compounded by how many records are displayed. So, inversely, you could lower the amount of records that are displayed to speed up the time it takes to apply the Formatting.

DLookup(), DMax(), DSum() are slow, so if you are using one of them in your Expression, you could attempt to return the data along with your Form's Record Source and then rewrite the Expression to use that instead and it should complete much faster.

I think you get the point on spending time to make the Expression as efficient as possible.

One last thing to consider is turning off the Screen Echo while the Formatting is taking place. I'm not sure if this is even possible or possible in your situation, it might be possible to turn off the screen at some opportune time like this:
Expand|Select|Wrap|Line Numbers
  1. Application.Echo False 
Then turn it back on at the right time:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_AfterFinalRender(ByVal drawObject As Object)
  2.     Application.Echo True
  3. End Sub
  4.  
I have no idea if this will work, it just a random thought.
Aug 12 '15 #4
Thank you jforbes and Rabbit for your insight. You have certainly confirmed my thoughts on the root of the issue. I was using a dlookup expression which was the worst for calculation time. Even just having a conditional format for Has Focus was still minimizing the drop list. Ultimately what worked for me, and this is certainly more of a work around than a fix, was to do a text box behind the entry box, assign the formatting to that box and set the entry box to transparent.

If I get some free time, I may play around with screen echo suggestion.

Thank you again for the information!
Aug 12 '15 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Jouke Langhout | last post by:
Hello all! For quite some time now, I've got the following problem: Access won't close properly when a user closes the application. An ACCESS process stays active and that process can only be...
2
by: Terry | last post by:
I have a form which displays data from both the Student Details table and the Exam Details table. The Name (Text Box) control is from the Student Details table and the Withdrawn (Check Box)...
2
by: jeffgeorge | last post by:
Trying to add 3 colors to 6 combinations of text possibilities. If this makes sense, the possibilities are: A D (one color for the combo beginning with A) A E B D (One color for the combo...
2
by: Megan | last post by:
Can you write conditional VBA code that affects only one or two records on a continuous subform? I have a form with a subform on it. The parent/ child field that links the forms is CaseID. The...
8
by: Typehigh | last post by:
I have many text fields with conditional formatting applied, specifically when the condition is "Field Has Focus". Without any events associated with the fields the conditional formatting works...
4
by: Michael R | last post by:
Does anyone know of such a way, or maybe have encountered an ActiveX control, that is able to have colors of conditional formatting on the drop-down list of a Combo box, besides the Combo box...
4
by: slinky | last post by:
Thanks in advance... I have a continuous style form with a field for each record called "STATUS". I simply want to have the form load and if the value of the textbox is "Inactive" I want the...
6
by: BUmed | last post by:
Hi all I’m trying to figure this out. But help is needed. I have a combo box called fcmFLAG with 5 options (problem, hold off, call, withdrew and ineligible). What I would like to do is have the...
3
by: aeon | last post by:
Working in Access 2007 on XP I have a combo box that I'm using in a form to select the WorkCategory assigned to a particular person in my database. WorkCategory is a lookup field in a table...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.