conditional formatting?

R

Rabbit

Is there a way to have a caption pop up instructing users to enter data in a
second field based on their choice in the first field?

Thanks
Christine
 
S

Steve Schapel

Christine,

Yes, there would be a number of ways to achieve something like this.
For example, you could have a label on the form, and use code on the
After Update event of the first control to toggle the Visible property
of the label.
 
R

Rabbit

Would the label be an unbound control? And not having written code, would
that be pretty simple to figure out? (I'm fairly new to access)

Thank you!
Christine
 
S

Steve Schapel

Christine,

A label is not a data control, so by definition always unbound.

Yes, the code would be pretty simple to figure out. If you need any
explicit help, just give us a hint about what you want to do.
 
R

Rabbit

Hi--I do (it turns out) need explicit help in writing code for this.

I have a field on my forms, KEEP, that when the value 4 is entered into the
field, a label pops up saying something like "Please enter a comment below".
How do I do this? I understand using the AfterUpdate event to switch the
label to visible, but I'm not sure what code would make this work.

Thanks for your help!
Christine
 
S

Steve Schapel

Christine,

Then code on the After Update event of the Keep control would be
something like this...
Me.NameOfYourLabel.Visible = (Me.Keep = 4)
 
R

Rabbit

Worked great. Thank you!

Steve Schapel said:
Christine,

Then code on the After Update event of the Keep control would be
something like this...
Me.NameOfYourLabel.Visible = (Me.Keep = 4)
 
R

Rabbit

Turns out that I now need to have this label toggle visible when KEEP = 2,3,
or 4. (possible values are 1-4)

What should this code look like? I tried putting in (Me.Keep = 2 Or 3 Or 4)
but the label just seemed to stay on no matter what was clicked.

Thanks for your help!
Christine
 
R

Ron2005

the test is incorrect.

if me.keep = 2 or me.keep = 3 or me.keep = 4 then
me.labelname.visible = true
else
me.labelname.visible = false
endif


OR

select case me.keep
case 2, 3, 4
me.labelname.visible = true
case else
me.labelname.visible = false
end select

In both cases you need to have the else otherwise once it goes on it
will not turn off by itself.

Ron
 
Top