Option button controlling text box

K

Ken McLennan

G'day there One & All,

I have what I hope is a smallish problem that can easily be resolved by
someone with more knowledge than me (which is a sizeable portion of the
populace I might add).

I have a userform with a collection of 9 optionbuttons inside a frame.
There is also a single textbox. The optionbuttons describe mutually
exclusive categories with the last being for "Other". I'm trying to make
the textbox disabled & locked until the "Other" optionbutton is
selected. I think I've got that bit worked out, however if the user has
erred and then clicks one of the other options I can't find a way to
again lock & disable the textbox as the optionbutton_onclick() event
isn't captured unless you click in the option. Naturally, that's what
selects that option, not unselects it.

Elsewhere in the form I've used a checkbox to do the same thing,
however that frame's "Other" is not intended to exclude other choices
like this one is. I'd much prefer to use an optionbutton as my users are
to a large degree not particularly computer literate and I want my forms
and application to do as much of the work as possible. I don't trust any
of my users to actually RTFM <g>.

Is there anyway that I can setup the "Other" optionbutton as a toggle?
Will I have to use the Frame's "Click" event to determine which
optionbutton has been selected and disable the textbox from that? (If
that works)

Any ideas would be appreciated, especially if they're simple enough
that I can understand what the heck is going on.

See ya
Ken McLennan
Qld, Australia
 
B

Bob Phillips

Ken,

I think you are going to have to put a test in each of the other option
buttons and if one of those is clicked, disable the textbox.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
L

Libby

Can't you just put something like following in the change
event for the "other" option button?

Private Sub OptionOTHER_Change()
TextBox1 = ""
TextBox1.Enabled = OptionOTHER.Value
End Sub
 
B

Bob Phillips

There are 8 other buttons.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
L

Libby

That wouldn't matter as it's based on the change event of
the "other" option button amd the option buttons are
mutually exclusive.
If "other" was clicked then it changes to true and the
textbox is enabled.
If any of the other option buttons are clicked
then "other" will change to false and the textbox will be
disabled.
 
K

Ken McLennan

G'day there Bob & Libby,
That wouldn't matter as it's based on the change event of
the "other" option button amd the option buttons are
mutually exclusive.
If "other" was clicked then it changes to true and the
textbox is enabled.
If any of the other option buttons are clicked
then "other" will change to false and the textbox will be
disabled.


Well, to cut a long story short, I used a combination of both
approaches which solved another problem I was working on at the same
time. Thank you both very much for your assistance =)

The problem now, and it's a big one, is that Windows found itself
a problem in some .dll file and fixed the problem by removing all the
code and userforms I had. About 5 weeks work (part time in amongst
various computer games <g> ) diappeared. I am NOT a happy camper.

That's one of the reasons I prefer to use Linux, but my employer
uses Windows and that's what I needed to work with. It's a good thing I
don't have a deadline.

See ya, and I've no doubt I'll be back if I get stumped again.
Thanks once more
Ken McLennan
Qld Australia
 
B

Bob Phillips

Ken,

You can't blame windows for you not having backups. If you rely on a system,
Windows, Linux or anything else, never to fail, you are asking for trouble,
and sooner or later you will get it.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
R

Rob van Gelder

Nicely said Bob.
There's something to be said for backup and version control systems.

But really...
Windows spots a DLL problem so it targets and deletes all the code and
userforms?! please.
That's like saying my dog ate my homework ;)
 
K

Ken McLennan

G'day there Bob,
You can't blame windows for you not having backups. If you rely on a system,

Of COURSE I can blame Windows. You don't think I'm going to accept
resposibility for my own stuff ups, do you? <g>.

As it happens, it's not as bad as I thought. I found a fairly
recent version at work where I'd emailed it for testing. It's not as up
to date as desirable, but it's better than starting from scratch.

See ya
Ken McLennan
Qld Australia
 
K

Ken McLennan

G'day there Rob,
Nicely said Bob.
There's something to be said for backup and version control systems.

Undoubtedly you're right. I'm still learning this stuff, and I
guess regular backups are part of it. Believe it or not, when I'm in
Linux I actually DO make fairly regular backup snapshots of my system.
But really...
Windows spots a DLL problem so it targets and deletes all the code and
userforms?! please.
That's like saying my dog ate my homework ;)

That was just my poor description of what it said. I didn't
understand the error message at the time, and later I just recalled the
..dll bit. At the time I saw the "Press OK and I'll try to rescue
something from the mess" message and thought that it might actually do
something useful.

What I can't understand is why Windows' solution to any problem
was to remove the code I had. Couldn't it just have isolated it so I
could then go & find what caused the problem? It's not as though a VB
app in Excel is going to threaten the integrity of the OS, is it?

Strange.

Take care,
See ya later,
Ken McLennan
 
B

Bob Phillips

Ken McLennan said:
G'day there Bob,
system,

Of COURSE I can blame Windows. You don't think I'm going to accept
resposibility for my own stuff ups, do you? <g>.

Well I never have!

As it happens, it's not as bad as I thought. I found a fairly
recent version at work where I'd emailed it for testing. It's not as up
to date as desirable, but it's better than starting from scratch.

Some good news at least. I often find this quite useful (glass half-full man
me), as you often easily recall what you did, and re-doing it makes you see
it in a clearer light and you end up with better code.
 
R

Rob van Gelder

re-doing it makes you see
it in a clearer light and you end up with better code

I agree - but I have a hard time convincing my boss that the code is sweeter
second time around <g>

But seriously. If I'm writing a serious bit of code which I know must be of
that *extra* quality, I'll treat the first code as draft even before I've
started. The second code is usually what you're happy with.
 
B

Bob Phillips

I'd love to take that approach to my designs, but I don't get that luxury I
am afraid.

As for that comment, if you're happy with your second draft, you're better
man than me <vbg>.

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 

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