Command Buttons not functioning

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

When I use the Command button from the Toolbox on the Form Design toolbar to
create an Add New Record button, the Add New Record Button appears onthe form
correctly. However, when you try to use the button in actual form view, the
following message appears:

The Expression On Click you entered as the event Property setting produced
the following error: ambiguous name detected: Print Form_click
*The expression may not result in the name of amacro, the name of a user
defined function or [Event Procedure]
*There may have been an error evaluating the function, event, or macro.
I can click OK but the new blank record does not come up. The same thing
happens when I try to create a print current record button. It soes not work.
I might note this is a new occurrence after installing Office SP3
 
Hi.

The error: "Ambiguous name detected: Print Form_click" means that you have
two or more procedures, variables, constants or properties of the same name
in your database application, most likely both are procedures defined on the
same form that is having this problem.

It's like having six sons named "George." If you yell, "George, take out
the trash!" they'll all ask, "Which George?" and stand there until you
clarify which one. Likewise, the computer can't decide the answer to the
question, "Which Print Form_click procedure is supposed to be executed
next?" You need to clarify which procedure the computer should execute.

Find and locate all occurrences of this "Print Form_click" name. Either
change the names of some of them to something else (and change everything
that references that occurrence of the procedure, variable, constant, or
property) or delete the extra occurrences that are redundant.
The same thing
happens when I try to create a print current record button.

You already have a print current record button on the form (at least you are
already using the same name for a procedure). The second one will be
redundant. To prevent the ambiguous name error, you can:

1.) Keep the first one and not create a second button of the same name, or

2.) Delete the first button of the same name and its procedure, or

3.) Rename the first button to something else, then create the new one with
this name.

HTH.

Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address, so that a message
will be forwarded to me.)


faxylady said:
When I use the Command button from the Toolbox on the Form Design toolbar to
create an Add New Record button, the Add New Record Button appears onthe form
correctly. However, when you try to use the button in actual form view, the
following message appears:

The Expression On Click you entered as the event Property setting produced
the following error: ambiguous name detected: Print Form_click
*The expression may not result in the name of amacro, the name of a user
defined function or [Event Procedure]
*There may have been an error evaluating the function, event, or macro.
I can click OK but the new blank record does not come up. The same thing
happens when I try to create a print current record button. It soes not work.
I might note this is a new occurrence after installing Office SP3
 
When I use the Command button from the Toolbox on the Form Design toolbar to
create an Add New Record button, the Add New Record Button appears onthe form
correctly. However, when you try to use the button in actual form view, the
following message appears:

The Expression On Click you entered as the event Property setting produced
the following error: ambiguous name detected: Print Form_click
*The expression may not result in the name of amacro, the name of a user
defined function or [Event Procedure]
*There may have been an error evaluating the function, event, or macro.
I can click OK but the new blank record does not come up. The same thing
happens when I try to create a print current record button. It soes not work.
I might note this is a new occurrence after installing Office SP3

When you delete a command button, the code associated with it is not
deleted. If you then add another command button with the same name and
write a new event procedure, you now have 2 procedures with that name.
Search you code and delete the older one.
 
It looks like you called your button "Form".

Its Click event procedure is then fighting with the event procedure that
handles clicking on the form.

Delete the button.
In the code window, delete all the lines from:
Private Sub Form_Click(...
to:
End Sub
Then try adding the button again, and give it a different name.

Once you have an "ambiguous name" problem, it probably will stop other
things from working. To check that Access can understand the code okay,
choose Compile from the Debug menu (in the Code window).

If that does not sort it out, please post a follow up to this thread.
 
Thank you for replying. How do I research the code? I am pretty much a
novice user of Access.

fredg said:
When I use the Command button from the Toolbox on the Form Design toolbar to
create an Add New Record button, the Add New Record Button appears onthe form
correctly. However, when you try to use the button in actual form view, the
following message appears:

The Expression On Click you entered as the event Property setting produced
the following error: ambiguous name detected: Print Form_click
*The expression may not result in the name of amacro, the name of a user
defined function or [Event Procedure]
*There may have been an error evaluating the function, event, or macro.
I can click OK but the new blank record does not come up. The same thing
happens when I try to create a print current record button. It soes not work.
I might note this is a new occurrence after installing Office SP3

When you delete a command button, the code associated with it is not
deleted. If you then add another command button with the same name and
write a new event procedure, you now have 2 procedures with that name.
Search you code and delete the older one.
 
Thank you for replying. How do I find all the occurrences of 'Print
Forn_Click" or "Add New Record_Click? That's a little more sophisticated
than I can handle without help.

'69 Camaro said:
Hi.

The error: "Ambiguous name detected: Print Form_click" means that you have
two or more procedures, variables, constants or properties of the same name
in your database application, most likely both are procedures defined on the
same form that is having this problem.

It's like having six sons named "George." If you yell, "George, take out
the trash!" they'll all ask, "Which George?" and stand there until you
clarify which one. Likewise, the computer can't decide the answer to the
question, "Which Print Form_click procedure is supposed to be executed
next?" You need to clarify which procedure the computer should execute.

Find and locate all occurrences of this "Print Form_click" name. Either
change the names of some of them to something else (and change everything
that references that occurrence of the procedure, variable, constant, or
property) or delete the extra occurrences that are redundant.
The same thing
happens when I try to create a print current record button.

You already have a print current record button on the form (at least you are
already using the same name for a procedure). The second one will be
redundant. To prevent the ambiguous name error, you can:

1.) Keep the first one and not create a second button of the same name, or

2.) Delete the first button of the same name and its procedure, or

3.) Rename the first button to something else, then create the new one with
this name.

HTH.

Gunny

See http://www.QBuilt.com for all your database needs.
See http://www.Access.QBuilt.com for Microsoft Access tips.

(Please remove ZERO_SPAM from my reply E-mail address, so that a message
will be forwarded to me.)


faxylady said:
When I use the Command button from the Toolbox on the Form Design toolbar to
create an Add New Record button, the Add New Record Button appears onthe form
correctly. However, when you try to use the button in actual form view, the
following message appears:

The Expression On Click you entered as the event Property setting produced
the following error: ambiguous name detected: Print Form_click
*The expression may not result in the name of amacro, the name of a user
defined function or [Event Procedure]
*There may have been an error evaluating the function, event, or macro.
I can click OK but the new blank record does not come up. The same thing
happens when I try to create a print current record button. It soes not work.
I might note this is a new occurrence after installing Office SP3
 
Thank you for replying. How do I get to the code window? I am a novice user.

Allen Browne said:
It looks like you called your button "Form".

Its Click event procedure is then fighting with the event procedure that
handles clicking on the form.

Delete the button.
In the code window, delete all the lines from:
Private Sub Form_Click(...
to:
End Sub
Then try adding the button again, and give it a different name.

Once you have an "ambiguous name" problem, it probably will stop other
things from working. To check that Access can understand the code okay,
choose Compile from the Debug menu (in the Code window).

If that does not sort it out, please post a follow up to this thread.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

faxylady said:
When I use the Command button from the Toolbox on the Form Design toolbar
to
create an Add New Record button, the Add New Record Button appears onthe
form
correctly. However, when you try to use the button in actual form view,
the
following message appears:

The Expression On Click you entered as the event Property setting produced
the following error: ambiguous name detected: Print Form_click
*The expression may not result in the name of amacro, the name of a user
defined function or [Event Procedure]
*There may have been an error evaluating the function, event, or macro.
I can click OK but the new blank record does not come up. The same thing
happens when I try to create a print current record button. It soes not
work.
I might note this is a new occurrence after installing Office SP3
 
Thank you for replying. How do I research the code? I am pretty much a
novice user of Access.

fredg said:
When I use the Command button from the Toolbox on the Form Design toolbar to
create an Add New Record button, the Add New Record Button appears onthe form
correctly. However, when you try to use the button in actual form view, the
following message appears:

The Expression On Click you entered as the event Property setting produced
the following error: ambiguous name detected: Print Form_click
*The expression may not result in the name of amacro, the name of a user
defined function or [Event Procedure]
*There may have been an error evaluating the function, event, or macro.
I can click OK but the new blank record does not come up. The same thing
happens when I try to create a print current record button. It soes not work.
I might note this is a new occurrence after installing Office SP3

When you delete a command button, the code associated with it is not
deleted. If you then add another command button with the same name and
write a new event procedure, you now have 2 procedures with that name.
Search you code and delete the older one.

Opn the form in design view.
Click on View + Code
Look!!!
 
When your form is open in design view, there is a toolbar icon for "Code".
The icon is a square with shiny corners and a red diamond at the top.

You can also get there by right-clicking a control (command button in this
case), and choosing Properites. On the Event tab, click the On Click
property where you see:
[event procedure]
Then click the Build button (...) beside that. This opens the code window
and takes you to the code for the button.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

faxylady said:
Thank you for replying. How do I get to the code window? I am a novice
user.

Allen Browne said:
It looks like you called your button "Form".

Its Click event procedure is then fighting with the event procedure that
handles clicking on the form.

Delete the button.
In the code window, delete all the lines from:
Private Sub Form_Click(...
to:
End Sub
Then try adding the button again, and give it a different name.

Once you have an "ambiguous name" problem, it probably will stop other
things from working. To check that Access can understand the code okay,
choose Compile from the Debug menu (in the Code window).

If that does not sort it out, please post a follow up to this thread.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

faxylady said:
When I use the Command button from the Toolbox on the Form Design
toolbar
to
create an Add New Record button, the Add New Record Button appears
onthe
form
correctly. However, when you try to use the button in actual form
view,
the
following message appears:

The Expression On Click you entered as the event Property setting
produced
the following error: ambiguous name detected: Print Form_click
*The expression may not result in the name of amacro, the name of a
user
defined function or [Event Procedure]
*There may have been an error evaluating the function, event, or macro.
I can click OK but the new blank record does not come up. The same
thing
happens when I try to create a print current record button. It soes
not
work.
I might note this is a new occurrence after installing Office SP3
 
Do I click on View menu, then code? What do you mean View + Code?

fredg said:
Thank you for replying. How do I research the code? I am pretty much a
novice user of Access.

fredg said:
On Sun, 26 Sep 2004 20:05:04 -0700, faxylady wrote:

When I use the Command button from the Toolbox on the Form Design toolbar to
create an Add New Record button, the Add New Record Button appears onthe form
correctly. However, when you try to use the button in actual form view, the
following message appears:

The Expression On Click you entered as the event Property setting produced
the following error: ambiguous name detected: Print Form_click
*The expression may not result in the name of amacro, the name of a user
defined function or [Event Procedure]
*There may have been an error evaluating the function, event, or macro.
I can click OK but the new blank record does not come up. The same thing
happens when I try to create a print current record button. It soes not work.
I might note this is a new occurrence after installing Office SP3

When you delete a command button, the code associated with it is not
deleted. If you then add another command button with the same name and
write a new event procedure, you now have 2 procedures with that name.
Search you code and delete the older one.

Opn the form in design view.
Click on View + Code
Look!!!
 
Back
Top