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!

Need help writing simple VBA script

Status
Not open for further replies.

Minuet

Technical User
Dec 18, 2002
48
CA
I am unfamiliar with VBA but need a simple script for my Access form. If my field "C_Type" = "04," then I would like the text in my "Name" field to be striked through (if possible), or red in colour instead of black. Could someone tell me how to write this? Thanks in advance!
 
Try this code to change colour to red


C_Type.SetFocus

If C_Type.Text = "4" Then
Name.ForeColor = vbRed

Else:
End If


Not sure how you can set it to Strike Though the field though David Lerwill
"If at first you don't succeed go to the pub"
 
Thanks for the code. I can't seem to make it work, though. What event do I use with the code? I have tried AfterUpdate, Change, Exit, and a few others. I don't know if it makes a difference, but I have Access 97.
 
Use it on Lost Focus on the test box would be the best idea David Lerwill
"If at first you don't succeed go to the pub"
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top