Hello ccg...
>> I think if you put your cursor within that procedure then click run, it will run. If cursor isn't within that procedure, you'll be asked to select a macro. <<
Clicking the Run will only invoke the procedure IF your procedure does not have any arguments. Your procedure has arguments, that is why Access if prompting you for a Macro ... You are asking VBA to run, but it can not run the procedure you're cursor is in because it does not know the values for those arguments, so it then asks for a Macro or Function procedure that does not have arguments to be passed.
If you want to invoke a procedure that has arguments, you can do that from the Immediate window of the VBA editor by typing the command, then hitting the enter key, NOT the "Run" button (the Run looks at your cursor position) ...
If you wish to see the result of a Function procedure that enter the command like this:
? SomeFunctionName(Arg1, Arg2, etc) {hit the enter key}
<the result will show here>
If you wish to invoke the execution of a Sub procedure or a Function that you have no need for the value returned (ie: a Function that is used like a Sub), then enter the command like this ..
SomeProcedureName Arg1, Arg2, Arg3, etc ... {hit the enter key}
....
For Example:
A "Function" (you want to know the result of a function or value of a property) type command from the immediate window ...
? 2 + 2
4
? CurrentDb.TableDefs("SomeLinkedTable").Connect
;Database=C:\SomePath\SomeFile.mdb
---------
A "procedural" (execute a the series of steps that make up the procedure) type call ...
DoCmd.DeleteObject acForm, "MyFormName" {hit the enter key}
<cursor will be flashing on the line below the command when the procedure>
---------
Aside from all this ... I would encourage you to use the code I posted as it is not AS library dependant (the constants are the only library dependant piece .. and you could use the numbers instead if you wish). Also, libraries become important if you declare object variables too! ... If you want to use the ADOX code, and you are getting errors, then please post the code you are using and the exact line the err is raised on.
Also ... your comment:
>> Maybe I will try to move them up in priority <<
If you have explicitly declared (ie: Dim rs As ADO.Recordset) your object variables, priority will not matter. I encourage explicit declaration of object variables.
Hope this helps!!