Discussion Locked

Form Properties from a Table in Access97

0 helpful
3 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

What is the simplest way to make a property of a textbox (input box) in a form dependent on the value in a field in a table record.
Example: I want the background color of certain input boxes to be yellow when field entry is true in a corresponding field (say a yes/no field or checkbox).
Can the object property be made dependent on a field withou having to do an IF in code?

3 replies

by ktirf

You can specify the value of a property as an expression, when you construct the form. Instead IF, there's a pleasant function IIf(), which evaluates the first argument and depending on the result substitutes either with the second arg (if 1st is true), or the third (if it is false). Thus, the value for the property will look like
=IIf(tablefield,yellow,white)
(don't forget '=' in the beginning)
I might mistake ',' instead of ';' between args. Try both. And replace the args with something sensible, of course ;)
Cheers!

This discussion is closed to new replies.