views:

1557

answers:

3

I have an Access 2007 Project with a SQL Server 2005 backend. However, when creating a new stored procedure from within Access, it comes up with an error:

ADO error: The specific schema name DOMAIN\username either does not exist or you do not have permission to use it

How can you create a stored procedure using the 'dbo' schema instead? The stored procedure properties dialog has the 'owner' dropdown set to the username and it can't be changed to dbo, even though the user is in the 'db_owner' role.

A: 

OK I would have the people create the procs on the SQL Server instead where you can add dbo to the create proc code. If you can't do that perhaps you could run code to change the owner after it is created using sp_changeobjectowner

HLGEM
A: 

Try making the user a member of the dbo schema rather than db_owner. This is how I do it.

As an aside you may want to look at the specific SQL Server management tool (Management Studio which comes with SQL Server 2005 or either the 2005 or 2008 express versions which are free downloads), this provides a richer interface for DDL type tasks.

Simon
I use Management Studio myself, which is also an option (if I find no other way round this issue). However, it is easier for the users to create the stored procedures in Access (no need to write any SQL code). Forms and Macro's in Access will be executing these stored procedures.
Sam
I use the free add-in at http://www.ssmstoolspack.com/ for Management Studio, amongst other things this gives you automatic CRUD SP creations tools. Maybe this will help?
Simon
I don't have dbo listed, just the db_* roles (as it is a schema, not a role). The user already has dbo as the default schema, but Access is not using it
Sam
A: 

Managed to solve it. If you make the user the owner of the database (rather than a user with the db_owner role), when you create a stored procedure in Access 2007, it creates it under the dbo schema rather than DOMAIN\username.

Steps to do so (in Management Studio):

  • Right click database, select Properties
  • Click File
  • Change Owner in the textbox
  • OK to confirm

Downside - other users under db_owner role will still have their username appended. So schemas have to be created for these users.

Sam