If your form is in Continuous View then in the Current Event for the form you should be able to put code that says
If Me.TextboxName = "SomeValue" Then
Me.Field1.ForeColor = vbBlue
Me.Field2.ForeColor = vbRed
.
.
.
Me.Fieldn.ForeColor = vbGreen
End If
You might want to checkout the Conditional Formatting option on the format menu. If you want to change the entire record, select each textbox, and choose Conditional Formatting. For the condition, choose "Expression Is" and enter a boolean expression in the box to the right. Such as UCase(Left([txtName],1))>"M" if you had a control named txtName. The would set the formatting if left character of txtName was greater than M (I know...stupid example). But it does add overhead to the screen performance. Maybe if the expression used a field from your underlying query may speed it up a bit.
The technique you describe with using conditional entries works fine. However, is there a way to change one of the other attributes of a field conditionally. For example, could I disallow a field to be updated based on a conditional entry?
Technically...Yes. But the Current event fires everytime user changes records, so in essence it would lock or unlock the record user is currently editing.
i have a similar issue trying to get the backcolor of a text box to change based on the value in another field.
What i am trying to do is allow the user to pick a color to associate it with a specific record.
i can pop up the Color window and get the long value that represents the color and store that with the record no problem.
Using the 'on current' event i can get the backcoor of my text box to display... but that changes the backcolor of all instances of the text box, where as i need each one to be a different color.
Any ideas what i can do...
it seems a shame there is no onformat event like on reports that i can use!
Did you ever find an answer to this
I am trying to do the same thing
Field1 on record 1 green because value is greater than 0
Field1 on record 5 red because value is negative
John, you should be able to use the Conditional Formatting that sfm6s524 speaks of in their first post. If that doesn't work, you may not be able to do what you want. Continuous forms work the same way a single view form does but the difference is you can see all the records. The record you are working in (that has the focus), is the one that will dictate what the formatting looks like in the rest of the records. The Conditional Formatting is designed to specifically address some, BUT NOT ALL, of the issues with this.
Good luck.
You might want to check out thread702-661512. You may get some ideas from that. Bill Power's example worked for me. I think he has one on one of his link's in the post.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.