Back Color Problem

Adam McReynolds

Registered User.
Local time
Today, 12:50
Joined
Aug 6, 2012
Messages
129
When I put my code into the afterupdate event of my text box it does not run. If I put it into the onclick event of a button it will run. Is the a parameter specific to the back color? Here is my code:
Code:
If Me.txt_incoming1 = "Completed" Then
Me.txt_incoming1.BackColor = vbGreen
Me.Refresh
End If
If Me.txt_incoming1 = "Warranty" Then
Me.txt_incoming1.BackColor = vbRed
Me.Refresh
End If
If Me.txt_incoming1 = "BER" Then
Me.txt_incoming1.BackColor = vbYellow
Me.Refresh
End If
 
When I put my code into the afterupdate event of my text box it does not run.

Has an update to the text box actually occurred that would trigger the code?

BTW - If you only have three conditions you can use Conditional Formatting.
 
Has an update to the text box actually occurred that would trigger the code?

BTW - If you only have three conditions you can use Conditional Formatting.

Thanks for the reply. Yes it has. This runs right before it:
Code:
Me.txt_incoming1 = DLookup("incoming_disposition", "tbl_module_repairs", "prikey = " & Me.txt_rid1 & "")
Me.Refresh

I should clarify that the code is in the afterupdate event of another text box (txt_rid1) but I have tried the code in each.

UPDATE: I tried conditional formatting and that worked great! Thanks Beetle.
 
Last edited:
Just so you know for future reference, updating a control (like a text box) via code or a macro will not trigger the After Update event for that control. This is only triggered if the control is updated via the normal UI.
 

Users who are viewing this thread

Back
Top Bottom