Help with Enable = false

T

TC

What do you mean, "to Enable a button = false" ?

If you want to enable a button, set its Enabled property to True in Design
mode of the form in question. Or, put code in that form's Open or Load event
to set that property depending on a condition that you check at runtime.

Also, is MPID a text field? If so, you should enclose the value of that
field, in quotes:

... "[MPID] = """ & Me![MPID] & """"

HTH,
TC
 
M

Morgan

I am using this code on a dblClick to open a form:

DoCmd.OpenForm "MPPFrm", , , "[MPID] = " & Me![MPID]

I want to inclide in the code if possible, to Enable a
button = false on the form that is being opened. the
button is called "Patient Search".

Can any body help.

Thanks Morgan
 
W

Wayne Morgan

Use the OpenArgs argument of the OpenForm command to pass a "code word" to
the opening form. In the opening form's Open event, check the value of the
OpenArgs for this code word and disable the button.

If Me.OpenArgs = "DisableTheButton" Then
Me.cmdMyButton.Enabled = False
End If
 
M

Morgan

How would I pass the code ford witht the code that I am
using?
-----Original Message-----
Use the OpenArgs argument of the OpenForm command to pass a "code word" to
the opening form. In the opening form's Open event, check the value of the
OpenArgs for this code word and disable the button.

If Me.OpenArgs = "DisableTheButton" Then
Me.cmdMyButton.Enabled = False
End If

--
Wayne Morgan
Microsoft Access MVP


I am using this code on a dblClick to open a form:

DoCmd.OpenForm "MPPFrm", , , "[MPID] = " & Me![MPID]

I want to inclide in the code if possible, to Enable a
button = false on the form that is being opened. the
button is called "Patient Search".

Can any body help.

Thanks Morgan


.
 
F

fredg

Morgan said:
How would I pass the code ford witht the code that I am
using?
-----Original Message-----
Use the OpenArgs argument of the OpenForm command to pass a "code word" to
the opening form. In the opening form's Open event, check the value of the
OpenArgs for this code word and disable the button.

If Me.OpenArgs = "DisableTheButton" Then
Me.cmdMyButton.Enabled = False
End If

--
Wayne Morgan
Microsoft Access MVP


I am using this code on a dblClick to open a form:

DoCmd.OpenForm "MPPFrm", , , "[MPID] = " & Me![MPID]

I want to inclide in the code if possible, to Enable a
button = false on the form that is being opened. the
button is called "Patient Search".

Can any body help.

Thanks Morgan

DoCmd.OpenForm "MPPFrm", , , , , , "DisableTheDarnedButton"

Then use Waynes code in the Load (or Open) event of the newly opened
form.
See Access Help for the various arguments of the OpenForm method.

As an alternative method of changing the Enabled property of the button
on the newly opened form, you can also do it this way:

DoCmd.OpenForm "MPPFrm"
forms!FormName!PatientSearch.Enabled = False
 

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