So it works for your text boxes. Is it being called for the combo box?
--
Doug Steele, Microsoft Access MVP
(no private e-mails, please)
message The code is being called because it works for all my text boxes.
:
Do you know that the code is being called? Put a breakpoint into it,
or a
message box outside of the If statement, just to be sure.
--
Doug Steele, Microsoft Access MVP
(no private e-mails, please)
message I tried clicking on the arrow and the box iteself. So both ways it
doesn't
seem to work.
Here is the code in my function
Private Function CheckClosedRecord()
If IsNull([CEODate]) Then
Else
MsgBox "This record is closed. Please contact the Database
Administrator or Quality Manager if you need to edit this record"
End If
End Function
:
Also, what are you clicking on in the combo box: the box itself, or
the
arrow to the right?
--
Doug Steele, Microsoft Access MVP
(no private e-mails, please)
message
What's the code in the function?
--
Doug Steele, Microsoft Access MVP
(no private e-mails, please)
"Secret Squirrel" <
[email protected]>
wrote
in
message
Actually I do have one follow up question. I put the function
name
in
all
the
"OnClick" events for all my controls but it doesn't seem to work
for
combo
boxes. Should I be doing something different for those?
:
Make sure that your existing module is a function, not a sub.
(It
doesn't
matter whether or not the function returns any value. In fact,
even
if
it
does, the value that's returned isn't going to be usable in
what
follows).
Select all of the controls on the form for which you want the
function
above
to apply. (Remember: not all controls have an OnClick event...)
You
do
this
selection by "lassoing" the relevant controls using your mouse,
or
by
holding down the Shift key while you click on the controls
one-by-one,
or a
combination of the two.
Once you've selected all of the controls of interest, look at
the
Properties
window. It's only going to display properties that exist for
all
of
the
selected controls. If you did your selection properly (i.e.: if
you
didn't
accidentally select a control that doesn't have an OnClick
event),
you
should see the OnClick event in the Properties window. Simply
type
=MyFunctionName() in the property box beside that event name,
and
it
will
apply to all of the selected controls. (In other words, it will
put
it
in
the OnClick event of all 50 controls at once)
--
Doug Steele, Microsoft Access MVP
(no private e-mails, please)
"Secret Squirrel" <
[email protected]>
wrote
in
message
Hi Tina,
I read that thread but I'm not sure I understand how to set
that
up. I
already have the msgbox function in my forms module. I just
don't
know
how
to
tie it into all the "On Click" events of all my controls so
that
it
appears
when the record is locked due to a date in one of my
controls.
:
the thread at
http://groups.google.com/group/micr...ss*+author:tina&rnum=1&hl=en#69089e7d34b618a3
explains how to set up a function call from the same event
of
multiple
controls in a form, all at once. note that if you're only
using
the
"msgbox
function" in one form, you can keep the function in that
form's
module -
you
don't have to add it to a standard module (that part of the
thread's
instructions was specific to the situation at hand).
hth
"Secret Squirrel" <
[email protected]>
wrote
in
message
I have a control on my form that locks a particular record
when
it
is
populated with a date. When that record is locked and a
user
clicks
in
a
field I want a message box to appear telling them that the
record
is
locked
and cannot be edited. I created a function with my msgbox
so
that I
can
have
all my controls point to but since I have close to 50
controls
is
there
an
easier way to have all the fields point to this function
instead
of
putting
code in each of the "On Click" events of all my controls?