A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Error When Adding Control Button to Form



 
 
Thread Tools Display Modes
  #1  
Old August 30th, 2006, 10:15 PM posted to microsoft.public.access.forms
doebtown
external usenet poster
 
Posts: 7
Default Error When Adding Control Button to Form

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.

  #2  
Old August 30th, 2006, 10:26 PM posted to microsoft.public.access.forms
mscertified
external usenet poster
 
Posts: 835
Default Error When Adding Control Button to Form

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" wrote:

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.


  #3  
Old August 30th, 2006, 10:58 PM posted to microsoft.public.access.forms
doebtown
external usenet poster
 
Posts: 7
Default Error When Adding Control Button to Form

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 wrote:
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" wrote:

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.



  #4  
Old August 31st, 2006, 12:28 AM posted to microsoft.public.access.forms
mscertified
external usenet poster
 
Posts: 835
Default Error When Adding Control Button to Form

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" wrote:

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 wrote:
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" wrote:

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.




 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 03:17 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.