On Change

blueboron

Registered User.
Local time
Today, 09:56
Joined
Aug 2, 2005
Messages
18
Hi,

I have a form with 6 field boxes - What I want to do is - on change of any of the fields value will change the background colour of all the fields in that record.

When I go to the next record all the fields will be their original colour until I change the value in any of the fields again - however if I am browsing the records - no colour change takes place.

I do not know how to code this:confused: - I would appreciate any clues to solve this.

Many thanks

Cliff
 
If you are using Access 2000 or above, you can do what I'm going to suggest. For each control that you want to change color, in it's properties find the TAG property and put something in there. You can choose any text you want, so maybe something like "color."

Then, in the ON DIRTY event of the form place:
Code:
Dim ctl as Control

For each ctl in Controls
  If ctl.Tag = "color" Then
     ctl.backcolor = Put your color number here or use a vb constant (like vbRed)
  End If
Next ctl

In the ON CURRENT event of the form, place this code to set the color back:
Code:
Dim ctl as Control

For each ctl in Controls
  If ctl.Tag = "color" Then
     ctl.backcolor = Put your original color number here
  End If
Next ctl
 
Many thanks - Will give it a go
 
Hi BL,

Have tried the above - however it works fine on a main form - but this form is a sub form & on loading etc there is code to update etc.
The fields change color once the focus is on the form and will not revert back on new record.

Many thanks.

CW
 

Users who are viewing this thread

Back
Top Bottom