HELP!!!!!

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

Guest

Hi

I have three fields on a form. I want to "grey out" the to other fields if the user select one of them and put some text in that field. If i could look the two other fields from receving data at the same time that would be great too..

Need help fast!!!

Erik
 
Not sure I understand your request. I think you are saying that if the
value of one field is a particular entry, then you would like to gray out
the other fields. If that is the case, dput something like this in the On
Change Event for the first field...


Private Sub Field1_Change()

If Field1 = "Red" Then ' or whatever value you want
Field2 = "50" ' set the value to whatever you want
Field2.Enabled = False ' change the field to not be enabled
Field3 = "100" ' set this field value
Field3.Enabled = False ' change to not enabled
End If

End Sub


Hopefully that is waht you are looking for.

Rick



Erik said:
Hi!

I have three fields on a form. I want to "grey out" the to other fields if
the user select one of them and put some text in that field. If i could look
the two other fields from receving data at the same time that would be great
too..
 
Hi!

thank you for your response. I`m sorry if my request was somewhat unclear. Im not looking for a particular entry, the case is that if the user makes any entry at all i want the box to be grayed out. The fields are all text fields..

is there any solutions

Erik
 
Erik said:
Hi!

I have three fields on a form. I want to "grey out" the to other
fields if the user select one of them and put some text in that
field. If i could look the two other fields from receving data at the
same time that would be great too..

So then, these controls are to be mutally exclusive, so that if there is
an entry made in any one of them, the others are to be disabled? If
that understanding is correct, you could do this with conditional
formatting (if you're using Access 2000 or later). For each of these
controls, set a formatting condition that disables the control if either
of the other controls is not Null.

Suppose you had three text boxes named "Text1", "Text2", and "Text3",
and you wanted them to behave like this. In design view, select Text1,
then click Format -> Conditional Formatting... Set the dropdown box for
Condition 1 to "Expression Is", and enter this for the expression:

Not (IsNull([Text2]) And IsNull([Text3]))

Then click the "Enabled" toggle button at the end of the formatting row
to make it be "Disabled".

Do the same thing for Text2 and Text3, except for them use the
expressions

Not (IsNull([Text1]) And IsNull([Text3]))

and

Not (IsNull([Text1]) And IsNull([Text2]))

respectively.
 
Erik

I believe what you want to do is to not only set the other fields to Enabled = False and/or Locked = True (control properties easily set in VBA code), but you also want to set BackStyle to Transparent instead of Normal. The latter is a control property that "greys out" the control and makes it immediately apparent to the user that it's not editable. Unfortunately this isn't able to be set so easily. It's not a True/False property. I also wanted to do this and I believe I read of a way to do it but fouind it to be too complicated to bother. I ended up just locking the control instead, as in

Forms!Formname!Controlname.Locked = Tru

ctda

----- Erik wrote: ----

Hi

I have three fields on a form. I want to "grey out" the to other fields if the user select one of them and put some text in that field. If i could look the two other fields from receving data at the same time that would be great too..

Need help fast!!!

Erik
 
ctdak said:
Erik,

I believe what you want to do is to not only set the other fields to
Enabled = False and/or Locked = True (control properties easily set
in VBA code), but you also want to set BackStyle to Transparent
instead of Normal. The latter is a control property that "greys out"
the control and makes it immediately apparent to the user that it's
not editable. Unfortunately this isn't able to be set so easily.
It's not a True/False property. I also wanted to do this and I
believe I read of a way to do it but fouind it to be too complicated
to bother. I ended up just locking the control instead, as in:

Forms!Formname!Controlname.Locked = True

ctdak

Simply setting Enabled = False, while leaving Locked = False, will "grey
out" the control while making it uneditable. It's only if you have
Enabled = False and Locked = True that the control still appears
editable (although it can't receive the focus).
 
Dirk said:
Simply setting Enabled = False, while leaving Locked = False, will "grey
out" the control while making it uneditable. It's only if you have
Enabled = False and Locked = True that the control still appears
editable (although it can't receive the focus).
Receive focus it can! Change characters in the field you cannot. (--Yoda)
 
Bas Cost Budde said:
Receive focus it can! Change characters in the field you cannot.
(--Yoda)

LOL

But you're saying that a control that is not enabled can receive the
focus? Show me.
 
Hi al

first i wish to say thank you for all sugestions! When i use the conditional formatting i get the job done!! it`s perfect for what i wanted. So thank thank thank you!!!!

Erik
 
LOL

But you're saying that a control that is not enabled can receive the
focus? Show me.
Ho, confusing True and False here. Never mind. (but we had a good laugh)
 
Back
Top