Hi CW
I would put the function in your form module and call it in the
Form_Current
event procedure, and also in the AfterUpdate event of the option button:
In Form_Current:
Call LockControls(True)
In YourButton_AfterUpdate:
Call LockControls( YourButton = <value for locked> )
The way you are doing it now should work OK, as the MouseDown event will
still work if AllowEdits is disabled.
You can file my function away for future use where you want to be more
selective about what gets enabled or disabled for editing
--
Good Luck!
Graham Mandeno [Access MVP]
Auckland, New Zealand
Graham,
I tried that method and, though I'm sure it works, I had some trouble
getting it to work for me. I wasn't even really sure where exactly I
was
suppose to put the function. I ended up selecting the "form" object
and
clicking on an event and going to code it in vb editor, then deleting
the
event opening/closing lines and just adding the function. Anyway, it
seemed
to work to lock the other controls but not to "unlock" the option
button.
I
feel sure I was suppose to modify the function in some way that I
didn't,
or
"call" it or something other than what I did.
I did find what seems like, at first glance, a pretty simple solution
of
my
own.
I put the "me.allowedits = false" back in the "on_current" event of the
form
(I had taken it out to try the function you gave me). Then, I went to
the
option button that I needed to be able to "edit", and put a
"Me.AllowEdits
=
True" on the "on_Mouse Down" event. I had the code I needed to
"un"hide
the
subform and resize the form already in the "on_click" event. AND, I
put
another "Me.AllowEdits = False" in the "on_Lost Focus" event.
It seems to work so far. Maybe there's a reason it's a bad idea to do
it
that way....I dunno.
Thanks again for the help. Hopefully, as time goes on, I'll learn more
about functions and where to put them.
CW
:
Thanks DG. Don't know how I missed that...
CW
:
message
When you say "tag", is that like a smart tag or does it have some
other meaning in your post?
Every Access control has a Tag property, which you can use entirely
for
your own purposes and set to any value you like. You'll find it on
the
Other tab of the control's property sheet in design view.
--
Dirk Goldgar, MS Access MVP
www.datagnostics.com
(please reply to the newsgroup)