Make a field available...

J

Joseph Hand

Access Masters,

I have a form with a field that contains a dropdown lookup field. One choice
is "Other". I have another field for the "other description that I would like
to be greyed out until "Other" is selected in the other field. Once "Other"
is selected, I want this field to become available...

And did I mention I am not a programmer? ;-)

Is this easy to accomplish? or am I dreaming again...???

Thanks in advance,

Joe Hand
 
J

Jeff Boyce

Joseph

One approach would be to add something like the following (*untested
aircode*) to an event procedure in the AfterUpdate event for that combobox
('dropdown'):

If Me!cboLookupSomething.Column(n) = "Other" Then
Me!txtOtherDescription.Enabled = True
Else
Me!txtOtherDescription.Enabled = False
End if

You need to substitute your fieldnames, and you need to determine which
"column" in the query/SQL feeding your combobox is the column holding the
word "Other" ... THEN you need to subtract 1. The .Column(n) is zero-based,
and starts counting at 0 instead of 1.

Good luck!

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
J

Joseph Hand

Jeff, that worked. Thank you! One more question though. If I go to a new
record, the field starts out active. Only when I choose something other than
"Other" does it disable the field. Is there a way to have it start out
disabled? and not wait till the corrosponding field is touched?

thannks again,
joe
 
C

Chegu Tom

Use the oncurrent event in your form. That will fire everytime you change
records
and then as per Jeff's code below
Me!txtOtherDescription.Enabled = False
then the action of the combo box will control the status after that
 
J

Jeff Boyce

You've received one suggestion, here's another...

Just make that control disabled to start with.

By the way, you may need to "call" that AfterUpdate procedure when you load
an existing records from the table into your form. After all, you DO want
that description box accessible if OTHER had already been chosen, right?

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
J

Joseph Hand

I ended up putting the exact same bunch of code in both places andd it worked
like a charm.

Thank you all!

joe
 

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