'Name' problem.

  • Thread starter Thread starter Tom
  • Start date Start date
T

Tom

When I try to run my macro, I get an error message:

"Microsoft Access can't find the name 'cdeLinkDB2Tables'
you entered in the expression."

I'm using Access 2000 with DB2 on an AS/400 on the
backend. The code DOES work, in debug mode. Here's my
setup:

table - tblODBCTables - db, library, table, field names
to which to link

macro - mcrLinkDB2Tables - RunCode - cdeLinkDB2Tables -

module -
mdl_MainProcedure -
Public Function cdeLinkDB2Tables
Public Sub cdeDeleteODBCTableNames

cdeLinkDB2Tables - code was debugged when this 'function'
was temporaarily made a 'sub'. All the current ODBC
table links are deleted and recreated per the entries in
the table tblODBCTables.

I came across a note about the module name not being the
same as the macro name, or some such (hence the 'cde'
prefix on the VBA code). But I still get the error.
Anyone have any ideas? Can anyone se what it is that I'm
[still] missing?

Thanks a lot, in advance,

Tom
 
Tom,
It looks like from your description the problem is that you are defining a
sub like a function.
Subs may or may not take parameters and have no return type. Functions must
have return types.
So functions are defined as follows:

public function MyFunction( My Args If Any ) AS MyReturnType
...
MyFunction = some value of type MyReturnType
...
end function

Subs are defined as:

public sub MySub( My Args If Any )
end sub

If your code routine doesn't need a return value, then define it as a sub.
If it does need a return value, then you will have to set it up with the
retrurn value as diagramed above.
 
Back
Top