Hi all,
I am trying to call a procedure with paramters from within another procedure in Access 2010. I've used this method before but for some reason it's throwing a strange error this time.
For testing I have created a new normal module, Module 1, and put in the following code:
When I run either test function--and even when I completely remove the parameters from the message function--I get an error thrown after Application.Run has executed.
I have no idea why this is thrown since I've used Application.Run before with no issues.
The only way to avoid the error message is to change the code to:
However I don't like just ignoring an error when I don't know what is causing it.
Does anybody know? Do you get the same error when you try the above code?
Edit: Added note, I tried this in a new empty database with no other applications open and it still threw the error.
Edit2: Should mention that the error is triggered after the "End Function" line is run in test_message_test()
I am trying to call a procedure with paramters from within another procedure in Access 2010. I've used this method before but for some reason it's throwing a strange error this time.
For testing I have created a new normal module, Module 1, and put in the following code:
Code:
Option Explicit
Function test_message_test(Optional str_test_Text As String)
Debug.Print str_test_Text & " <-- that was some text"
End Function
Function test_callfunction_test()
Application.Run test_message_test("Hello world.")
End Function
Function test_callfunctionwithoutparams_test()
Application.Run test_message_test
End Function
Code:
Microsoft Visual Basic
Run-time error '2517':
MyDatabaseName cannot find the procedure '.'
The only way to avoid the error message is to change the code to:
Code:
Function test_callfunction_test()
On Error GoTo err_hnd
Application.Run test_message_test("Hello world.")
Exit Function
err_hnd:
If Err.Number = 2517 Then Resume Next
End Function
Does anybody know? Do you get the same error when you try the above code?
Edit: Added note, I tried this in a new empty database with no other applications open and it still threw the error.
Edit2: Should mention that the error is triggered after the "End Function" line is run in test_message_test()
Last edited: