Error 2950

  • Thread starter Thread starter Ronald
  • Start date Start date
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.
 
Ronald,

Can you please give details of the macro, i.e. action(s) and argument(s),
and also the details of the basClearTables function.
 
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.
 
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?
 
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.
 
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.
 
Back
Top