Forms

B

bdehning

I have a macro in the on click for a command button. When button is selected
a message box appears.

What do I need to do to trigger two fields that have been disabled to be
enabled when the OK for the message is selected?
 
R

Rick Brandt

bdehning said:
I have a macro in the on click for a command button. When button is
selected a message box appears.

What do I need to do to trigger two fields that have been disabled to
be enabled when the OK for the message is selected?

If MsgBox("blah blah",vbOkCancel) = vbOk Then
Me!ControlName1.Enabled = True
Me!ControlName2.Enabled = True
Else
Me!ControlName1.Enabled = False
Me!ControlName2.Enabled = False
End If
 
B

bdehning

Rick, now I am being slow.

Where do I place it. Is it some action in the macro after the masbox?
 
R

Rick Brandt

bdehning said:
Rick, now I am being slow.

Where do I place it. Is it some action in the macro after the masbox?


Sorry, I am not familar with Macros as I only use VBA code. In VBA a MsgBox can
simply be displayed with...

MsgBox "blah blah"

....or the response from the MsgBox (which button was clicked) can be stuffed
into a variable with...

MyVariable = MsgBox("blah")

I have no idea how that is done with macros.
 
S

Steve Huff

As Rick mentioned you really should learn to use VBA code versus MACROs, but
if you want to do it in a Macro after the message box set the Action to
"SetValue" the Item selection to "[Forms]![Form1]![Text0].[Enabled]" where
Forms1 is the name of your form and Text0 is the name of your controal and
set the expression to True.

If you are interested, in code this would look like this:

MsgBox "hello world", vbOKOnly, ""
Forms!Form1!Text0.Enabled = True

Hope this helps...
 
B

bdehning

Yes, you and Rick are correct, code is much better to use than built in items
that you do not have code for or understaand. I was tryijng to use a mcro
and code and not much success. Once I went strictly to code the two fields
worked liked I expected them to in the on click event.

I am learning more and more about code and code is much easier to do what
ever a person wants as long as you now the correct coding.

Thanks Rick and Steve. Next issue will be code again in a new post.

Steve Huff said:
As Rick mentioned you really should learn to use VBA code versus MACROs, but
if you want to do it in a Macro after the message box set the Action to
"SetValue" the Item selection to "[Forms]![Form1]![Text0].[Enabled]" where
Forms1 is the name of your form and Text0 is the name of your controal and
set the expression to True.

If you are interested, in code this would look like this:

MsgBox "hello world", vbOKOnly, ""
Forms!Form1!Text0.Enabled = True

Hope this helps...
--
_______________________
Steve Huff
http://www.huffs.us
Generic email: null(removethis)@huffs.us

bdehning said:
I have a macro in the on click for a command button. When button is
selected
a message box appears.

What do I need to do to trigger two fields that have been disabled to be
enabled when the OK for the message is selected?
 
Top