name doesn't exist problem

T

Tom

I have code I want to execute when I open Access. I've
created a macro with 'RunCode' - cdeLinkDB2Tables.

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:

table - tblODBCTables - db, library, table, index field
names

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 see what it is that
I'm [still] missing?

Thanks a lot, in advance,

Tom
 
W

Wayne Morgan

Typo? In the Macro design window, instead of typing in the name of the
function, click the ... box to the right of where you type the name in. In
the Expression Builder, you should see a + next to Functions in the lower
left window. Click the + to open it and there should be at least two
options, Built-In Functions and one that has the same name as your database.
Choose the 2nd one. In the next pane to the right should be a list of
modules. Select the module that contains the function and the function
should show in the right most pane. Double click the function name to place
it in the "code" window and click ok to return to the macro design window.
The function name should have been added for you.
 
T

Tom

Thanks. But that didn't work. When I do as you say, I
get 'cdeLinkODBCTables «strDSN», «strSchema», «strSchemaPw
d»)'. Then the error msg says it can't find '«strDSN»'.
All I HAD been using was the function
name 'cdeLinkODBCTables'. I was removing everything
else.

I've tried using the function name with the parens. THAT
didn't work either. (Wrong number of arguments.)

Let's try this again. Here's my function statement:

Public Function cdeLinkODBCTables(strDSN As String,
strSchema As Variant, strSchemaPwd As Variant) As Boolean

So what EXACTLY am I supposed to enter in my macro? It
currently has only one action, "RunCode", with the name
of my function, "cdeLinkODBCTables". Nothing else in the
function name. No Parens, no strings, nothing
except "cdeLinkODBCTables" (without the quotes of course).

Thanks in advance,

Tom
-----Original Message-----
Typo? In the Macro design window, instead of typing in the name of the
function, click the ... box to the right of where you type the name in. In
the Expression Builder, you should see a + next to Functions in the lower
left window. Click the + to open it and there should be at least two
options, Built-In Functions and one that has the same name as your database.
Choose the 2nd one. In the next pane to the right should be a list of
modules. Select the module that contains the function and the function
should show in the right most pane. Double click the function name to place
it in the "code" window and click ok to return to the macro design window.
The function name should have been added for you.

--
Wayne Morgan
Microsoft Access MVP


I have code I want to execute when I open Access. I've
created a macro with 'RunCode' - cdeLinkDB2Tables.

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:

table - tblODBCTables - db, library, table, index field
names

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 see what it is that
I'm [still] missing?

Thanks a lot, in advance,

Tom


.
 
T

Tom

I got it. Thanks.
-----Original Message-----
Typo? In the Macro design window, instead of typing in the name of the
function, click the ... box to the right of where you type the name in. In
the Expression Builder, you should see a + next to Functions in the lower
left window. Click the + to open it and there should be at least two
options, Built-In Functions and one that has the same name as your database.
Choose the 2nd one. In the next pane to the right should be a list of
modules. Select the module that contains the function and the function
should show in the right most pane. Double click the function name to place
it in the "code" window and click ok to return to the macro design window.
The function name should have been added for you.

--
Wayne Morgan
Microsoft Access MVP


I have code I want to execute when I open Access. I've
created a macro with 'RunCode' - cdeLinkDB2Tables.

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:

table - tblODBCTables - db, library, table, index field
names

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 see what it is that
I'm [still] missing?

Thanks a lot, in advance,

Tom


.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top