text box enables itself after clicking on somewhere else

  • Thread starter Thread starter WJ
  • Start date Start date
W

WJ

I have a combo box "Client_Broker_Combo", and a text box
following it "Broker_Other_Fill_In". So if the user
selects "Other" from the combo box, then I want to
enable
the text box, so that the user can enter the broker name.

And I want to disable the text box if the user chooses
nothing from the combo. Right now, I've set the property
of the text box to be disabled. But
everytime I click on somewhere else, for example other
checkboxes, the text box would automatically enable itself
even if there was STILL nothing in the combo box above it.

So potentially, a user can put nothing in the combo, and
click somewhere else, and then enter something in the text
box.....

The following is the code I have:


It's ideal to find a way to deal with this in code. But
I've tried "IsNull", IsEmpty, =""...but nothing works...
please help...

Thanks!!
WJ
 
WJ said:
I have a combo box "Client_Broker_Combo", and a text box
following it "Broker_Other_Fill_In". So if the user
selects "Other" from the combo box, then I want to
enable
the text box, so that the user can enter the broker name.

And I want to disable the text box if the user chooses
nothing from the combo. Right now, I've set the property
of the text box to be disabled. But
everytime I click on somewhere else, for example other
checkboxes, the text box would automatically enable itself
even if there was STILL nothing in the combo box above it.

So potentially, a user can put nothing in the combo, and
click somewhere else, and then enter something in the text
box.....

The following is the code I have:



It's ideal to find a way to deal with this in code. But
I've tried "IsNull", IsEmpty, =""...but nothing works...
please help...


What is the value of the combo's bound column when you
select "Other" from a visinle column? Whatever that is,
it's what you should be comparing to in your code:

If Client_Broker_Combo = xxx Then

Note that I changed the comparison to = so that the text box
is only enabled for the value you want. A minor difference,
but there are a few situations, especially Null, where the
If condition will fail when the combo is not set to "Other".
You only want it enabled when it is "Other".
 
Thanks Marsh.

I've never used Bound Column. But The Bound Column value
for all items in the combo is "1".....can you be more
specific on which value to use after the "="?

Thanks a lot.

WJ
 
You're getting ahead of yourself here. First you have to
understand how the combo box works (either that or we have
to agree on our nomenclature so we can understand each
other).

Yes, the BoundColumn property contains a 1, but what is the
first field in the combo box's RowSource table/query/value
list? Especially, what is in the first field of the record
that has "Other" in the first non-zero ColumnWidth column?

Just in case I still need more details, please post back
with an explanation of the fields in the combo box's
RowSource table/query/value list.
 
Ok, the Row Source of the combo is "Broker ID" field, from
the table "Broker ID".

The table "Broker ID" contains only one field, and the
contents are the names of the brokers: broker1,
broker2, .. and "Other".

Sorry but I'm afraid I still don't understand...:S...

Thanks,
WJ

-----Original Message-----
You're getting ahead of yourself here. First you have to
understand how the combo box works (either that or we have
to agree on our nomenclature so we can understand each
other).

Yes, the BoundColumn property contains a 1, but what is the
first field in the combo box's RowSource table/query/value
list? Especially, what is in the first field of the record
that has "Other" in the first non-zero ColumnWidth column?

Just in case I still need more details, please post back
with an explanation of the fields in the combo box's
RowSource table/query/value list.
--
Marsh
MVP [MS Access]


I've never used Bound Column. But The Bound Column value
for all items in the combo is "1".....can you be more
specific on which value to use after the "="?
text
box

.
 
OK, we're working with a single column, the combo's
BoundCloumn and ColumnCount properties are both 1, right?

If so, then the If statement you had should work, except for
Null values, which changing the If to check for = instead of
<> should take care of.

If Me.[Client_Broker_Combo] = "Other" Then
Me.Broker_Other_Fill_In.Enabled = True
Else
Me.Broker_Other_Fill_In.Enabled = False
End If

The only other thing I can think of that would cause that
code to fail when you select "Other" is if there was some
non-visible character in the table's value.
 
That worked! Great! Thanks so much!

WJ
-----Original Message-----
OK, we're working with a single column, the combo's
BoundCloumn and ColumnCount properties are both 1, right?

If so, then the If statement you had should work, except for
Null values, which changing the If to check for = instead of
<> should take care of.

If Me.[Client_Broker_Combo] = "Other" Then
Me.Broker_Other_Fill_In.Enabled = True
Else
Me.Broker_Other_Fill_In.Enabled = False
End If

The only other thing I can think of that would cause that
code to fail when you select "Other" is if there was some
non-visible character in the table's value.
--
Marsh
MVP [MS Access]


Ok, the Row Source of the combo is "Broker ID" field, from
the table "Broker ID".

The table "Broker ID" contains only one field, and the
contents are the names of the brokers: broker1,
broker2, .. and "Other".

Sorry but I'm afraid I still don't understand...:S...

where
the

.
 
Back
Top