0

I have been trying to sort this error and can't understand why it is happening. tried changing name of the sub and check many times to make sure the spelling is exactly the same but the error keeps ocurring and i can't understand why. Can someone help?

Error Message

3

1 Answer 1

2

You should not use the same name the module and the procedure. This will cause a conflict.

So if you Call SortDataSource it will find the module name first and of course it cannot call a module (only a procedure or function within a module).

So if you use the same names you need to Call SortDataSource.SortDataSource to make it call the procedure SortDataSource inside the module SortDataSource:

Syntax is like

Call ModuleName.MethodName(Argument1, Argment2)

or without Call which is not needed.

ModuleName.MethodName Argument1, Argment2

But I highly recommend not to use the same name for a module and a procedure. As you can see it can cause errors that can easily be avoided by choosing different names.

Sign up to request clarification or add additional context in comments.

7 Comments

Quick question, doesnt ModuleName.MethodName Argument1, Argument2 give an error? shouldn't it be ModuleName.MethodName(Argument1, Argument2) Not tryna be rude or anything. was just wondering :)
Yes, if using Call then the brackets are required.
@Rory arrrg yes of course! I never use it. Thanks for pointing out.
Thank you. so why does it work when i use the other call without specifying method name "Call RowDelete" but it does not work with "Call RowSort" and I have to do the Call ModuleName.MethodName Argument1, Argment2 for that one?
@RubenGaspar Don't get your question. What exactly works and what doesn't? Please be more precise. If you need to post more code please edit your original question add the code there and leave a comment.
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.