Visible

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi. I'd like to set up my form so that if Ongoing = yes, certain fields are
grayed out.

For example, if Ongoing = no, I'd like the user to be able to enter the
[Date], but have the [StartDate] grayed out (not available for entry).
But if Ongoing = no, I'd like the [Date] to be grayed out, but have the
[StartDate] to be available for entry.

I think I need to use visible, but not sure of the syntax or event.
 
Stephanie said:
Hi. I'd like to set up my form so that if Ongoing = yes, certain
fields are grayed out.

For example, if Ongoing = no, I'd like the user to be able to enter
the [Date], but have the [StartDate] grayed out (not available for
entry).
But if Ongoing = no, I'd like the [Date] to be grayed out, but have
the [StartDate] to be available for entry.

I think I need to use visible, but not sure of the syntax or event.

I don't know about using the Visible property, since you want controls
ot be grayed out, not just invisible. What you describe sounds like it
could be done with the Conditional Formatting feature, if you're using
Access 2000 or later. You'd set up CF conditions for [Date] and
[StartDate], based on expressions involving the truth value of
[Ongoing], enabling or disabling [Date] and [StartDate] accordingly.
 
Hi. I'd like to set up my form so that if Ongoing = yes, certain
fields are grayed out.

For example, if Ongoing = no, I'd like the user to be able to enter
the [Date], but have the [StartDate] grayed out (not available for
entry). But if Ongoing = no, I'd like the [Date] to be grayed out, but
have the [StartDate] to be available for entry.

I think I need to use visible, but not sure of the syntax or event.

Hi Stephanie,

It sounds like you need to manipulate the "Enable" property.

--- aircode example ---
If Ongoing = "Yes" Then
Me!StartDate.Enable = True
Me!Date.Enable = False '-- Really lousy name for a field!!!
Else
Me!StartDate.Enabled = False
Me!Date.Enabled = True
End If

Having said all of that, this scheme will probably tick off the user!

What if they entered the wrong date? If you disable the control, how do
they get back in to correct the date?

HTH
 
the Visible property shows/hides a control, rather than "graying it out" or
not. setting a control's Enabled property to False will "gray out" the
control. try the following code in the Ongoing control's AfterUpdate event,
and in the form's Current event, as

Me!Date.Enabled = (Me!Ongoing = "no")
Me!StartDate.Enabled = Not (Me!Ongoing = "no")

the above code serves as a toggle between True and False, setting the
Enabled property according to the value in the Ongoing control.

btw, if you actually have a field in your table named "Date", recommend you
change the name (you can easily do this by adding a prefix or suffix to the
name). in certain circumstances, the system may confuse a fieldname "Date"
with the Date function in Access, causing problems all around.

hth
 
Thanks all- I'll try out your suggestions and see what is the best fit. I
appreciate your time.
 
Back
Top