Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

MS Access permissions error when creating Table in VBA

Status
Not open for further replies.

kbondar

Programmer
May 21, 2007
3
US
HI,
I have Access DB and I am trying to create temp_table in Access DB using VBA, and every time it generates the following error:
"You do not have the necessary permissions to use the 'Temp_table' object. Have your system administrator or the person who created this object establish the appropriate permissions for you."
I have full permission to DB, I was trying to change security level in Access, but it still doesn't work, and I don't know what to do. Here is the code I use:

Dim ADOConnection As ADODB.Connection
Dim ADORecordset As ADODB.Recordset
Dim ADOCommand As ADODB.Command
Dim ADOXCatalog As ADOX.Catalog
Dim sSQL As String

'Get Connection
Call OpenADOQueryConnection(ADOConnection, ADORecordset)

'Create table
Set ADOCommand = New ADODB.Command
ADOCommand.ActiveConnection = ADOConnection

sSQL = "CREATE TABLE Temp_table ([Field1] TEXT(50))"
ADOCommand.CommandText = sSQL
ADOCommand.Execute , , adCmdText

I use the same code to create table in another DB I have, and it works, but not for this one. And I can't find the difference in DB security settings.
Thanks.
 
Try recreating the access database from scratch (ie a blank one).

Create a form with a button one it and paste your code into the click event, don't forget the OpenADOQueryConnection procedure.

I have done this with your code and it works, so it looks like there maybe a problem with the access database you have inserted this code into.
 
Thank you,
but the problem is I need to use that DB, and it's too big to recreate it again from scratch. It has something to do with DB Permissions. Do you know what can I change in the DB I am using, may be something in User and group permissions, so it works?
Thanks
 
I just checked again, and if I create DB from scratch in MS Access this code doesn't work, It doesn't work for any DB I created, I have only one DB where it works, and it was created by the guy who used to work here before me. He must have changed something in DB permission.. or I don't know what he did, but when I try to create table in his DB, using VBA it works.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top