conditional formatting with combobox

G

Guest

i am using a2k.

i've tried to find a posting relevant to the specifics of the current one
and therefore....

to make things simple, let's say i have a combobox (cbx) on my form as a
bound control to an underlying table. the control source and name of the
control is 'Cycle'. it's defined as a 'byte' number on the table's design and
gets filled in by the user from a l/u table having the values
0,1,2,3,4,....28,99 (there are no numbers btwn 28 and 99 on purpose).

what i'm trying to do is cause this field to have a red background when the
user is creating a new record to draw user's attention to fact it needs to be
entered (it is the second member of a composite PK comprising "Patient
Number" and "Cycle"). so, i want the background to display in red until the
user's entered a value from the l/u table.

what i've done is decreed the field's default color is red and in the
conditional formatting pull down thing used an "Expression is" option for
Condition 1 that says "[Cycle] Is Not Null" (w/o the quotation marks).

it's weird, but the field color is never red for this cbx control when the
field is open i add record mode although it is red in the design mode. the
other thing that's weird is that if, instead of using this "Expression is"
option, i replace that with "Field is less than" 0, then no the field does
turn red when user goes to add new record and it never stops being red (no
matter what value from the cbox is selected). to round things out a
bit.....however there is a neighboring control alongside it called "Day
Number" which has the said configuration which complies with my design?!?

any clues?
 
N

Nonprofit Tech via AccessMonster.com

In the On Current event of the form, place the following code:
If Me.NewRecord = True Then Me.cbx.BackColor = 255
This will cause the background of the combo box to appear red if it is a
new record.

Then, in the After Update event of control cbx, place the following code:
Me.cbx.BackColor = 16777215
This will return the combo box background to white after the field has been
updated and the user moves to a new field.
 
G

Guest

it's come to my attention that "Cycle" is a term for an Access property, i.e.
"You can use the Cycle property to specify what happens when you press the
TAB key and the focus is in the last control on a bound form", ergo, this
should not be a name conferred upon a control.

thanks for the bandwidth though.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top