Solved Vba backcolor

skdn71

New member
Local time
Today, 11:41
Joined
Jul 23, 2023
Messages
27
Hello,

Could you please help with VBA

If value on Text box, the Box1 backcolor must be Red ( see picture)
If value on combobox the Box2 backcolor must be Red ( see picture)

Thank you
 

Attachments

  • Data.accdb
    Data.accdb
    564 KB · Views: 113
  • Prnscr.jpg
    Prnscr.jpg
    43 KB · Views: 98
No VBA needed, use Conditional formatting.
 
I try with conditional formating but not working, I get color on Textbox instead of Box1

Please help
 
You are using the wrong button. :(
Use the one next to the Undeline button.

1690107057372.png
 
I get the same result
 

Attachments

  • 2023-07-23 12_20_45-Window.jpg
    2023-07-23 12_20_45-Window.jpg
    12.7 KB · Views: 100
The CF has to be in the control you are trying to use it on? :(

You are using it on the field you are testing? :( However are you testing for anything? You need to test if the large controls are empty or not.

Anyway it show it is working, just on the wrong control.
 
I Can't use conditional formating on Box1 please check the attachement i can do only on Textbox
 
Sorry, I did not realise you actuall had a box, I thought that was just your techincal name for the control. :)
As you mention, they do not have a CF option.

So code as you requested.

1690108937275.png

Code:
Private Sub Naam_AfterUpdate()
If Not Me.Naam & "" = "" Then
    Me.Box1.BackColor = vbRed
End If
End Sub

However you have the backstyle as Transparent, so will never see the colour until you change that. :(
 

Users who are viewing this thread

Back
Top Bottom