Error When Adding Control Button to Form

D

doebtown

I posted this message earlier today, but I've subsequently come across
some new information that might be helpful in the troubleshooting
process.

When I use the Command Button Wizard to add a Command Button to one of
my forms that is intended to open another form, Access returns the
following message after I click the new button:

"The expression on Click you entered as the even property setting
produced the following error: A problem occurred while Microsoft Office

Access was communicating with the OLE server or ActiveX Control.


*The expression may not result in the name of a macro, the name of a
user-defined function, or [Event Procedure].
*There may have been an error evaluating the function, event, or
macro."


Access does NOT return this error message if I add a Command Button to
a DIFFERENT form in the same database. Other than the code that the
Wizard added for the new button, there doesn't appear to be any code
for the form that's making the trouble.

The new tidbit that I've discovered is that I CAN add a button to this
form that runs a macro. No problem. But as soon as I try to get the
button to execute a script, I get this error message.

This is beyond my skill level, but I NEED to be able to add new buttons

to this form that will let me open other forms. Any help is GREATLY
appreciated.
 
G

Guest

What does your button do?
Did you look at the event property for the button to see what it is doing,
is it running a macro or an event procedure or what?

Dorian
 
D

doebtown

Dorian - Thanks for your message. Yeah, I want the button to run an
event procedure. The exact code that I would like the button to fire
is:

Private Sub Command62_Click()
On Error GoTo Err_Command62_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "CW Information"

stLinkCriteria = "[MCN]=" & Me![MCN]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command62_Click:
Exit Sub

Err_Command62_Click:
MsgBox Err.Description
Resume Exit_Command62_Click

"MCN" is, incidentially, my Primary Key. The idea, here, is to begin
to enter preliminary information about this record and--if
necessary--be able to click this button where I'll be taken to ANOTHER
form that lets me enter more, detailed information about the record
based on the information that was previously entered. I could put all
the fields on the first form, I guess, but my goal was to have SEVERAL
of these detail-oriented buttons and it would ultimately get TOO
cluttered all on one form.

LMK if you gots any ideas. Best Wishes
mscertified said:
What does your button do?
Did you look at the event property for the button to see what it is doing,
is it running a macro or an event procedure or what?

Dorian

doebtown said:
I posted this message earlier today, but I've subsequently come across
some new information that might be helpful in the troubleshooting
process.

When I use the Command Button Wizard to add a Command Button to one of
my forms that is intended to open another form, Access returns the
following message after I click the new button:

"The expression on Click you entered as the even property setting
produced the following error: A problem occurred while Microsoft Office

Access was communicating with the OLE server or ActiveX Control.


*The expression may not result in the name of a macro, the name of a
user-defined function, or [Event Procedure].
*There may have been an error evaluating the function, event, or
macro."


Access does NOT return this error message if I add a Command Button to
a DIFFERENT form in the same database. Other than the code that the
Wizard added for the new button, there doesn't appear to be any code
for the form that's making the trouble.

The new tidbit that I've discovered is that I CAN add a button to this
form that runs a macro. No problem. But as soon as I try to get the
button to execute a script, I get this error message.

This is beyond my skill level, but I NEED to be able to add new buttons

to this form that will let me open other forms. Any help is GREATLY
appreciated.
 
G

Guest

If your button's name is Command62 and you have the 'on click' event property
set to 'event procedure', it should fire the procedure.

Dorian

doebtown said:
Dorian - Thanks for your message. Yeah, I want the button to run an
event procedure. The exact code that I would like the button to fire
is:

Private Sub Command62_Click()
On Error GoTo Err_Command62_Click

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "CW Information"

stLinkCriteria = "[MCN]=" & Me![MCN]
DoCmd.OpenForm stDocName, , , stLinkCriteria

Exit_Command62_Click:
Exit Sub

Err_Command62_Click:
MsgBox Err.Description
Resume Exit_Command62_Click

"MCN" is, incidentially, my Primary Key. The idea, here, is to begin
to enter preliminary information about this record and--if
necessary--be able to click this button where I'll be taken to ANOTHER
form that lets me enter more, detailed information about the record
based on the information that was previously entered. I could put all
the fields on the first form, I guess, but my goal was to have SEVERAL
of these detail-oriented buttons and it would ultimately get TOO
cluttered all on one form.

LMK if you gots any ideas. Best Wishes
mscertified said:
What does your button do?
Did you look at the event property for the button to see what it is doing,
is it running a macro or an event procedure or what?

Dorian

doebtown said:
I posted this message earlier today, but I've subsequently come across
some new information that might be helpful in the troubleshooting
process.

When I use the Command Button Wizard to add a Command Button to one of
my forms that is intended to open another form, Access returns the
following message after I click the new button:

"The expression on Click you entered as the even property setting
produced the following error: A problem occurred while Microsoft Office

Access was communicating with the OLE server or ActiveX Control.


*The expression may not result in the name of a macro, the name of a
user-defined function, or [Event Procedure].
*There may have been an error evaluating the function, event, or
macro."


Access does NOT return this error message if I add a Command Button to
a DIFFERENT form in the same database. Other than the code that the
Wizard added for the new button, there doesn't appear to be any code
for the form that's making the trouble.

The new tidbit that I've discovered is that I CAN add a button to this
form that runs a macro. No problem. But as soon as I try to get the
button to execute a script, I get this error message.

This is beyond my skill level, but I NEED to be able to add new buttons

to this form that will let me open other forms. Any help is GREATLY
appreciated.
 

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