I'm Stumped - Invalid Procedure Call Error

D

Dan K

I redesigned an old database that someone put together a few years ago... I
copied a clever "switchboard" form w/ VB code that they had either written or
copied off of the net. I’m pretty good with Access Frontend processes but my
VB knowledge is almost nonexistent…

Everything was running fine until I had to add some additional macros
because of a design flaw. After this recent update, however, I’m getting a
strange error when I run a specific macro off of the switchboard.

The switchboard runs other macros fine and if I run this particular macro
manually I get no problems. But when I run the macro from the switchboard I
stumble upon an error handling message that the original designer put in
place, though once you OK passed the error box, the macro seems to run fine.
Here’s the message I’m seeing (message underlined):

HandleButtonClick_Err:
' If the action was cancelled by the user for
' some reason, don't display an error message.
' Instead, resume on the next line.
If (Err = conErrDoCmdCancelled) Then
Resume Next
Else
MsgBox "There was an error executing the command.", vbCritical
Resume HandleButtonClick_Exit
End If

End Function


In order to find the specific problem I added the following to the MsgBox
line:

MsgBox "There was an error executing the command.", vbCritical, , 16384


And now in place of the previous message box I get the following error:

“The expression On Click you entered as the event property setting produced
the following error: Invalid procedure call or argument.
• 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

Show Help:
…
For help restoring missing references, see the Microsoft Knowledge Base
article 283806.
…â€

I checked out the MKB link but it doesn’t seem to have anything to do with
the error I’m seeing. I tried debugging the VB code and everything seems to
works fine. I’m a little stumped as to how to proceed.

Couple questions:
1) Was I right in adding the 16384 to the Msgbox function to get the error
detail?
2) Is this Invalid Procedure Call a problem in the VB code or the Macro
itself? Combo of both?
 
S

Stuart McCall

Dan K said:
I redesigned an old database that someone put together a few years ago... I
copied a clever "switchboard" form w/ VB code that they had either written
or
copied off of the net. I'm pretty good with Access Frontend processes but
my
VB knowledge is almost nonexistent.

Everything was running fine until I had to add some additional macros
because of a design flaw. After this recent update, however, I'm getting a
strange error when I run a specific macro off of the switchboard.

The switchboard runs other macros fine and if I run this particular macro
manually I get no problems. But when I run the macro from the switchboard
I
stumble upon an error handling message that the original designer put in
place, though once you OK passed the error box, the macro seems to run
fine.
Here's the message I'm seeing (message underlined):

HandleButtonClick_Err:
' If the action was cancelled by the user for
' some reason, don't display an error message.
' Instead, resume on the next line.
If (Err = conErrDoCmdCancelled) Then
Resume Next
Else
MsgBox "There was an error executing the command.", vbCritical
Resume HandleButtonClick_Exit
End If

End Function


In order to find the specific problem I added the following to the MsgBox
line:

MsgBox "There was an error executing the command.", vbCritical, , 16384


And now in place of the previous message box I get the following error:

"The expression On Click you entered as the event property setting
produced
the following error: Invalid procedure call or argument.
. 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

Show Help:
.
For help restoring missing references, see the Microsoft Knowledge Base
article 283806.
."

I checked out the MKB link but it doesn't seem to have anything to do with
the error I'm seeing. I tried debugging the VB code and everything seems
to
works fine. I'm a little stumped as to how to proceed.

Couple questions:
1) Was I right in adding the 16384 to the Msgbox function to get the error
detail?
2) Is this Invalid Procedure Call a problem in the VB code or the Macro
itself? Combo of both?

Try:

If (Err.Number = conErrDoCmdCancelled) Then
 
J

JimBurke via AccessMonster.com

Err is an error object, so you need to reference one of it's properties. Like
Stuart said, probably Err.Number.

Dan said:
I redesigned an old database that someone put together a few years ago... I
copied a clever "switchboard" form w/ VB code that they had either written or
copied off of the net. I’m pretty good with Access Frontend processes but my
VB knowledge is almost nonexistent…

Everything was running fine until I had to add some additional macros
because of a design flaw. After this recent update, however, I’m getting a
strange error when I run a specific macro off of the switchboard.

The switchboard runs other macros fine and if I run this particular macro
manually I get no problems. But when I run the macro from the switchboard I
stumble upon an error handling message that the original designer put in
place, though once you OK passed the error box, the macro seems to run fine.
Here’s the message I’m seeing (message underlined):

HandleButtonClick_Err:
' If the action was cancelled by the user for
' some reason, don't display an error message.
' Instead, resume on the next line.
If (Err = conErrDoCmdCancelled) Then
Resume Next
Else
MsgBox "There was an error executing the command.", vbCritical
Resume HandleButtonClick_Exit
End If

End Function

In order to find the specific problem I added the following to the MsgBox
line:

MsgBox "There was an error executing the command.", vbCritical, , 16384

And now in place of the previous message box I get the following error:

“The expression On Click you entered as the event property setting produced
the following error: Invalid procedure call or argument.
• 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

Show Help:
…
For help restoring missing references, see the Microsoft Knowledge Base
article 283806.
…â€

I checked out the MKB link but it doesn’t seem to have anything to do with
the error I’m seeing. I tried debugging the VB code and everything seems to
works fine. I’m a little stumped as to how to proceed.

Couple questions:
1) Was I right in adding the 16384 to the Msgbox function to get the error
detail?
2) Is this Invalid Procedure Call a problem in the VB code or the Macro
itself? Combo of both?
 
D

Dirk Goldgar

Dan K said:
I redesigned an old database that someone put together a few years ago... I
copied a clever "switchboard" form w/ VB code that they had either written
or
copied off of the net. I’m pretty good with Access Frontend processes but
my
VB knowledge is almost nonexistent…

Everything was running fine until I had to add some additional macros
because of a design flaw. After this recent update, however, I’m getting a
strange error when I run a specific macro off of the switchboard.

The switchboard runs other macros fine and if I run this particular macro
manually I get no problems. But when I run the macro from the switchboard
I
stumble upon an error handling message that the original designer put in
place, though once you OK passed the error box, the macro seems to run
fine.
Here’s the message I’m seeing (message underlined):

HandleButtonClick_Err:
' If the action was cancelled by the user for
' some reason, don't display an error message.
' Instead, resume on the next line.
If (Err = conErrDoCmdCancelled) Then
Resume Next
Else
MsgBox "There was an error executing the command.", vbCritical
Resume HandleButtonClick_Exit
End If

End Function


In order to find the specific problem I added the following to the MsgBox
line:

MsgBox "There was an error executing the command.", vbCritical, , 16384


And now in place of the previous message box I get the following error:

“The expression On Click you entered as the event property setting
produced
the following error: Invalid procedure call or argument.
• 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

Show Help:
…
For help restoring missing references, see the Microsoft Knowledge Base
article 283806.
…â€

I checked out the MKB link but it doesn’t seem to have anything to do with
the error I’m seeing. I tried debugging the VB code and everything seems
to
works fine. I’m a little stumped as to how to proceed.

Couple questions:
1) Was I right in adding the 16384 to the Msgbox function to get the error
detail?

No. So far as I can see, that argument should be a helpcontextID associated
with a specific help file, which would have to have been provided as a
separate argument following the Title argument, which you've left out. It
seems to me that you might have succeeded with something like this:

MsgBox _
"There was an error executing the command.", _
vbCritical + vbMsgBoxHelpButton, _
"Error!", _
Err.HelpFile, _
Err.HelpContext

But that may or may not help you with the original problem, depending on the
nature of the error. I would recommend including a bit more information in
your error message; maybe like this:

MsgBox _
"There was an error executing the command. " & _
"The system message was: " & Err.Description, _
vbCritical + vbMsgBoxHelpButton, _
"Error " & Err.Number, _
Err.HelpFile, _
Err.HelpContext
2) Is this Invalid Procedure Call a problem in the VB code or the Macro
itself? Combo of both?

The "Invalid Procedure Call" message appears to have been caused by the
error in your VB code calling the MsgBox function. If you replace that code
with the second example above, you should get more information about the
nature of the original error.

Note that there is nothing wrong with the line:
If (Err = conErrDoCmdCancelled) Then

.... provided that conErrDoCmdCancelled has been defined. My guess is that
it has been defined as the value 2501.
 
D

Dan K

Dirk and everybody else,
Thanks.. that did the trick. I appreciate the help!
Dan



Dirk Goldgar said:
Dan K said:
I redesigned an old database that someone put together a few years ago... I
copied a clever "switchboard" form w/ VB code that they had either written
or
copied off of the net. I’m pretty good with Access Frontend processes but
my
VB knowledge is almost nonexistent…

Everything was running fine until I had to add some additional macros
because of a design flaw. After this recent update, however, I’m getting a
strange error when I run a specific macro off of the switchboard.

The switchboard runs other macros fine and if I run this particular macro
manually I get no problems. But when I run the macro from the switchboard
I
stumble upon an error handling message that the original designer put in
place, though once you OK passed the error box, the macro seems to run
fine.
Here’s the message I’m seeing (message underlined):

HandleButtonClick_Err:
' If the action was cancelled by the user for
' some reason, don't display an error message.
' Instead, resume on the next line.
If (Err = conErrDoCmdCancelled) Then
Resume Next
Else
MsgBox "There was an error executing the command.", vbCritical
Resume HandleButtonClick_Exit
End If

End Function


In order to find the specific problem I added the following to the MsgBox
line:

MsgBox "There was an error executing the command.", vbCritical, , 16384


And now in place of the previous message box I get the following error:

“The expression On Click you entered as the event property setting
produced
the following error: Invalid procedure call or argument.
• 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

Show Help:
…
For help restoring missing references, see the Microsoft Knowledge Base
article 283806.
…â€

I checked out the MKB link but it doesn’t seem to have anything to do with
the error I’m seeing. I tried debugging the VB code and everything seems
to
works fine. I’m a little stumped as to how to proceed.

Couple questions:
1) Was I right in adding the 16384 to the Msgbox function to get the error
detail?

No. So far as I can see, that argument should be a helpcontextID associated
with a specific help file, which would have to have been provided as a
separate argument following the Title argument, which you've left out. It
seems to me that you might have succeeded with something like this:

MsgBox _
"There was an error executing the command.", _
vbCritical + vbMsgBoxHelpButton, _
"Error!", _
Err.HelpFile, _
Err.HelpContext

But that may or may not help you with the original problem, depending on the
nature of the error. I would recommend including a bit more information in
your error message; maybe like this:

MsgBox _
"There was an error executing the command. " & _
"The system message was: " & Err.Description, _
vbCritical + vbMsgBoxHelpButton, _
"Error " & Err.Number, _
Err.HelpFile, _
Err.HelpContext
2) Is this Invalid Procedure Call a problem in the VB code or the Macro
itself? Combo of both?

The "Invalid Procedure Call" message appears to have been caused by the
error in your VB code calling the MsgBox function. If you replace that code
with the second example above, you should get more information about the
nature of the original error.

Note that there is nothing wrong with the line:
If (Err = conErrDoCmdCancelled) Then

.... provided that conErrDoCmdCancelled has been defined. My guess is that
it has been defined as the value 2501.


--
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)
 

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