Error 2950

R

Ronald

Hi.

The only thing my macro has to do is to call the (Public Function)
basClearTables(), but that results in a 2950 error.
I can't find any description. I suspect is has to do with a reserved word.
Is this true?
But why 'basClearTables' isn't a reserved word...

Thanks,

Ronald.
 
S

Steve Schapel

Ronald,

Can you please give details of the macro, i.e. action(s) and argument(s),
and also the details of the basClearTables function.
 
R

Ronald

Hi Steve.

It's really very simple.
In the macro in Action: RunProcedure, Argument: basClearTables()
that's all.

And in a module:
Public Function basClearTables()

Dim db as DAO.Database

Set db = CurrentDb
With [db]
.Execute "DELETE * FROM [Tablename];"

and a few more tables to clear.

.Close
End With
Set db = Nothing

End Function

When I set a Breakpoint on the Public Function basClearTables() line, I get
the error before the breakpoint is reached.
When I change basClearTables() to basXXX() in the macro and code, the macro
functions well and the tables are cleared!
But I still like to know why the basClearTables is not accepted.

Ronald.
 
S

Steve Schapel

Ronald,

It is interesting that it works when you change the name. There are some
syntax features of your code that I found a bit odd. For example, the []s
around [db], and the .Close, but obviously it can't be related to that if it
works with a rename.

Any chance that you have another procedure somewhere else in the application
that is also named basClearTables? Or a module with that name? In fact,
even the module that it's in?
 
R

Ronald

Hi Steve.

The []s (incase there is a space in the object variable name, but I use it
for clarity) and the .Close are totally acceptable.

But when I checked for another basClearTables function I found there was one
in another module. I never thought of that.
Thank you!!!

Ronald.

Steve Schapel said:
Ronald,

It is interesting that it works when you change the name. There are some
syntax features of your code that I found a bit odd. For example, the []s
around [db], and the .Close, but obviously it can't be related to that if it
works with a rename.

Any chance that you have another procedure somewhere else in the application
that is also named basClearTables? Or a module with that name? In fact,
even the module that it's in?

--

Steve Schapel, Microsoft Access MVP


Ronald said:
Hi Steve.

It's really very simple.
In the macro in Action: RunProcedure, Argument: basClearTables()
that's all.

And in a module:
Public Function basClearTables()

Dim db as DAO.Database

Set db = CurrentDb
With [db]
.Execute "DELETE * FROM [Tablename];"

and a few more tables to clear.

.Close
End With
Set db = Nothing

End Function

When I set a Breakpoint on the Public Function basClearTables() line, I
get
the error before the breakpoint is reached.
When I change basClearTables() to basXXX() in the macro and code, the
macro
functions well and the tables are cleared!
But I still like to know why the basClearTables is not accepted.
 
S

Steve Schapel

Glad we found an explanation, Ronald. :)

However...

The []s (incase there is a space in the object variable name, but I use
it
for clarity) and the .Close are totally acceptable.

Er, not really. You can't declare an object variable with a space in the
name - VBA won't allow it. And there's no point closing something you
didn't open.
 

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

Similar Threads

2950 Return without GoSub 1
VBA function runs in debug mode but not in macro. 3
Error 2950 1
Can't Run Macro 2
Data() 4
Error Number 2950 2
Access OpenArgs in Access 2010 failing 0
ODBC - call failed during runing of macro 1

Top