Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing Field Back Color

Status
Not open for further replies.

Phudsen

Technical User
Mar 7, 2003
136
A2
Hi,

I have a tabular form that lists staff information:
StaffID, Name,Email,Mobile,Telephone, Status and some other fields. I am displaying all the data in our department in a tabular form.

Is it possible to change the backcolor of one cell after being updated?

Example: A staff changes his/her mobile number, when I open the tabular form and edit the mobile number in his/her record, the mobile number cell "Field" changes backcolor into something else, red for instance.

Or if it is easier change the font color.

This will tell that this information is new.

Thanks
Paulin
 
Paulin
On the AfterUpdate event for the field, put the following...

Me.YourFieldName.BackColor = vbRed (or whatever colour you wish)

Tom
 
Hi Tom,

Thank you for your reply.

The form that I am talking about is a tablular "Continuous" if I put your code all the fields in the column will be changed into red.

I know this code and I have used it successfully with colunmar.

Any ideas?

Thank you Tom
 
Paulin
I see. But I'm not clear why you want to change the colour...in other words, what's the purpose of making the change?

Also, do you want to make the change permanent for that one cell, or just while the record has focus?

If the particular field in question is to permanently change when updated, say that you update the Mobile phone number field from Black to Red, but then a few months later change it to something else, to what colour does the updated field go then?

Tom
 
Hi Tom,

Your question is logical, this is also what I asked the boss. He said that the color of change can stay for sometime then be deleted. He will delete it when he reads the new information.

What I did and worked was:
I have the following fields:
StaffID, Name,Email,Mobile,Telephone

I added
StaffIDSig, NameSig, EmailSig, MobileSig, TelephoneSig

width is 1 character.

In the update form I added a textbox with the value of "*" this value will be inserted in the table according to the field. If the Name is updated, after update the field NameSig will get the value of the textbox which is *.

In the displaying tabular form I added those fields next to the related fields and made them as one. So, when the change is done a star will appear next to the changed field. Then made a delete query for the boss to run when finished seeing the new info. The delete query will delete all the stars "*" from the table. Then the boss will be able to see the new updated done by the secretary. The secretary will also know that the boss has seen the updated when she does not see the stars. The secratary cannot remove the stars, she can only add them when she updates.

This is working fine, but I am looking for a shorter way.

Thanks Tom
Paulin
 
Hi!

I agree with you that adding fields to the recordsource is the only way to achieve such formatting as your boss desires. The stars are an OK way to achieve an effect, another way, would be to use Yes/No fields per each of the fields. Those wouldn't have to be visible on the secretary's form at all, but be triggered by some event (after update on the controls/before update of the form?), and could be used for conditional formatting (format menu).

Changing the values of the check box in the after update of a (each) control (here just one):

[tt]Me!chkNameSig.Value = True[/tt]

Using the before update event of the form, one could try comparing the current value of each control with the .OldValue property:

[tt]if me!txtNameSig.Value <>me!txtNameSig.OldValue Then
Me!chkNameSig.Value = True
end if
if me!txtSigId...[/tt]

Then for each control, select it, enter the conditional formatting, select expression is in the first dropdown, then enter the control name of the corresponding yes/no field (in [brackets]), select the format and...

Roy-Vidar
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top