Creating a public sub-procedure

Awes

Usually Confused
Local time
Today, 15:51
Joined
Aug 20, 2002
Messages
34
Hi Everyone

I am trying, not very succesfully, to write a sub-procedure that can be called from a number of forms.

Having read a number of Access Help pages on writing and calling a sub-procedure I can't get it to work, so it is now time to throw it over to you helpful people to point me in the right direction.

According to the help pages I need to create a new module and make it Public, so I have created a module called 'subLogError' with the folowing structure:

Public Sub subLogError (ErrNo, ErrSource)

Dim .......
Statements
.....
.....

Exit Sub

End Sub


In my form I have the following line which should call the sub-procedure:

subLogError ErrNo, ErrSource


The problem that I am having is that when this line of code is reached I get the following error message:

"Expected Variable or Procedure, not Module"

I'm sure that it is just me missing the blindingly obvious but my mind has gone blank on what that could be, so any comments would be gratefully received.

Many thanks

Awes.
 
The module name cannot be the same as that of Functions, Subs etc Rename the module PublicFunc or something and it ought to work

HTH
 
Hi Harry

Many thanks for that. I have renamed the module and it now works a treat.

I knew it had to be something simple i just couldn't see it.

Next time I won't waste hours trying to guess I'll just ask.

Cheers

Awes
 

Users who are viewing this thread

Back
Top Bottom