Can't delete table "You do not have the necessary permisions to us

S

Stuart Bratesman

I have an Access 2000 mdb database (for backwards compatibility) that I
developed in Access 2007. It is protected by User Level Security. When it
opens, it imports three tables from a user-level secured backend database,
runs some queries, prints a report, and then deletes the three imported
tables before closing.*

It was working fine yesterday, but today when the VBA code tries to delete
any of the three imported tables, it generates the dreaded runtime error
3033, "You do not have the necessary permisions to use the [table name]
object. Have your system administrator or the person who created this object
establish the appropriate permissions for you."

I am using the database as the database owner and I (and all the Full Data
Users) are assigned every User Permission you can find in the User and Group
Permissions dialogue box.

Here is the VBA code that deletes the three imported tables:

'############################
Private Sub btnDeleteTables_Click()

Dim dbs As Object
Dim dbs1 As Database
Dim obj As AccessObject

Set dbs = Application.CurrentData
Set dbs1 = OpenDatabase(Application.CurrentProject.FullName)

' Search the AllTables collection for any of the
' three imported tables and delete each one.

For Each obj In dbs.AllTables

Select Case obj.Name
Case "Table1"
dbs1.Execute "DROP TABLE " & obj.Name
Case "Table2"
dbs1.Execute "DROP TABLE " & obj.Name
Case "Table3"
dbs1.Execute "DROP TABLE " & obj.Name
End Select

Next obj

dbs1.Close

End Sub
'####################

The line that triggers the error is,

dbs1.Execute "DROP TABLE " & obj.Name
in,
Select Case obj.Name
Case "Table1"
dbs1.Execute "DROP TABLE " & obj.Name

As I wrote, it worked like a charm yesterday. I can't think of anything I
did in other parts of the code that would affect this sub-routine.

No changes have been made in the User and Group Permissions dialogue box. I
have Administrator permissions for all three of the imported tables.

Any answers or suggestions would be greatly appreciated.

- Stuart Bratesman
_________________________________________
* User Level Security is required for the backend database since it also
uses Replication to allow users to detact their laptop from their network and
collect data in the field. The three table have to be imported. They cannot
be linked because the backend mdb file has an apostrophe in its file name.
When a table is linked from a database with Access Restricted Characters in
its file name, an error prevents one from being able to delete the links.
Any query that is based on one of these linked table cannot be re-opened in
Design View. The backend's file name is going to change in the next version
upgrade.
 
S

Stuart Bratesman

I've found an alternative solution.

I was able to create a SQL Data Definition query for each of the tables I
wanted to delete. Example:

DROP TABLE Table1;

Then I used a VBA command:

DoCmd.OpenQuery "qryDrop_Table1"

to run each of the three data definition queries. The tables are gone and
there are no error messages. Yipee!

- Stuart Bratesman

The run

--
Stuart Bratesman, Jr., MPP
Muskie School of Public Service
Univ. of Southern Maine
Portland, Maine


Stuart Bratesman said:
I have an Access 2000 mdb database (for backwards compatibility) that I
developed in Access 2007. It is protected by User Level Security. When it
opens, it imports three tables from a user-level secured backend database,
runs some queries, prints a report, and then deletes the three imported
tables before closing.*

It was working fine yesterday, but today when the VBA code tries to delete
any of the three imported tables, it generates the dreaded runtime error
3033, "You do not have the necessary permisions to use the [table name]
object. Have your system administrator or the person who created this object
establish the appropriate permissions for you."

I am using the database as the database owner and I (and all the Full Data
Users) are assigned every User Permission you can find in the User and Group
Permissions dialogue box.

Here is the VBA code that deletes the three imported tables:

'############################
Private Sub btnDeleteTables_Click()

Dim dbs As Object
Dim dbs1 As Database
Dim obj As AccessObject

Set dbs = Application.CurrentData
Set dbs1 = OpenDatabase(Application.CurrentProject.FullName)

' Search the AllTables collection for any of the
' three imported tables and delete each one.

For Each obj In dbs.AllTables

Select Case obj.Name
Case "Table1"
dbs1.Execute "DROP TABLE " & obj.Name
Case "Table2"
dbs1.Execute "DROP TABLE " & obj.Name
Case "Table3"
dbs1.Execute "DROP TABLE " & obj.Name
End Select

Next obj

dbs1.Close

End Sub
'####################

The line that triggers the error is,

dbs1.Execute "DROP TABLE " & obj.Name
in,
Select Case obj.Name
Case "Table1"
dbs1.Execute "DROP TABLE " & obj.Name

As I wrote, it worked like a charm yesterday. I can't think of anything I
did in other parts of the code that would affect this sub-routine.

No changes have been made in the User and Group Permissions dialogue box. I
have Administrator permissions for all three of the imported tables.

Any answers or suggestions would be greatly appreciated.

- Stuart Bratesman
_________________________________________
* User Level Security is required for the backend database since it also
uses Replication to allow users to detact their laptop from their network and
collect data in the field. The three table have to be imported. They cannot
be linked because the backend mdb file has an apostrophe in its file name.
When a table is linked from a database with Access Restricted Characters in
its file name, an error prevents one from being able to delete the links.
Any query that is based on one of these linked table cannot be re-opened in
Design View. The backend's file name is going to change in the next version
upgrade.

--
Stuart Bratesman, Jr., MPP
Muskie School of Public Service
Univ. of Southern Maine
Portland, Maine
 
C

Catherine Sea

Thanks for your information.

Cathrine Sea
http://www.dynamsoft.com
http://www.scmsoftwareconfigurationmanagement.com/

Stuart Bratesman said:
I've found an alternative solution.

I was able to create a SQL Data Definition query for each of the tables I
wanted to delete. Example:

DROP TABLE Table1;

Then I used a VBA command:

DoCmd.OpenQuery "qryDrop_Table1"

to run each of the three data definition queries. The tables are gone and
there are no error messages. Yipee!

- Stuart Bratesman

The run

--
Stuart Bratesman, Jr., MPP
Muskie School of Public Service
Univ. of Southern Maine
Portland, Maine


Stuart Bratesman said:
I have an Access 2000 mdb database (for backwards compatibility) that I
developed in Access 2007. It is protected by User Level Security. When it
opens, it imports three tables from a user-level secured backend database,
runs some queries, prints a report, and then deletes the three imported
tables before closing.*

It was working fine yesterday, but today when the VBA code tries to delete
any of the three imported tables, it generates the dreaded runtime error
3033, "You do not have the necessary permisions to use the [table name]
object. Have your system administrator or the person who created this object
establish the appropriate permissions for you."

I am using the database as the database owner and I (and all the Full Data
Users) are assigned every User Permission you can find in the User and Group
Permissions dialogue box.

Here is the VBA code that deletes the three imported tables:

'############################
Private Sub btnDeleteTables_Click()

Dim dbs As Object
Dim dbs1 As Database
Dim obj As AccessObject

Set dbs = Application.CurrentData
Set dbs1 = OpenDatabase(Application.CurrentProject.FullName)

' Search the AllTables collection for any of the
' three imported tables and delete each one.

For Each obj In dbs.AllTables

Select Case obj.Name
Case "Table1"
dbs1.Execute "DROP TABLE " & obj.Name
Case "Table2"
dbs1.Execute "DROP TABLE " & obj.Name
Case "Table3"
dbs1.Execute "DROP TABLE " & obj.Name
End Select

Next obj

dbs1.Close

End Sub
'####################

The line that triggers the error is,

dbs1.Execute "DROP TABLE " & obj.Name
in,
Select Case obj.Name
Case "Table1"
dbs1.Execute "DROP TABLE " & obj.Name

As I wrote, it worked like a charm yesterday. I can't think of anything I
did in other parts of the code that would affect this sub-routine.

No changes have been made in the User and Group Permissions dialogue box. I
have Administrator permissions for all three of the imported tables.

Any answers or suggestions would be greatly appreciated.

- Stuart Bratesman
_________________________________________
* User Level Security is required for the backend database since it also
uses Replication to allow users to detact their laptop from their network and
collect data in the field. The three table have to be imported. They cannot
be linked because the backend mdb file has an apostrophe in its file name.
When a table is linked from a database with Access Restricted Characters in
its file name, an error prevents one from being able to delete the links.
Any query that is based on one of these linked table cannot be re-opened in
Design View. The backend's file name is going to change in the next version
upgrade.

--
Stuart Bratesman, Jr., MPP
Muskie School of Public Service
Univ. of Southern Maine
Portland, Maine
 

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