Help with Enable = false

  • Thread starter Thread starter TC
  • Start date Start date
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
 
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
 
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
 
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


.
 
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
 
Back
Top