Owner Access Queries

Microsoft Jet gives you a powerful method to leverage security when using queries. You can use the optional WITH OWNERACCESS OPTION clause in your queries to give the person running the query the permission levels assigned to the query’s owner.

For example, suppose that a user doesn’t have permission to view the payroll information in your application. You can create a query that uses the WITH OWNERACCESS OPTION to allow the user to view this information:

SELECT LastName,
FirstName, Salary
FROM Employees
ORDER BY LastName
WITH OWNERACCESS OPTION;

Additionally, if a user is otherwise prevented from creating or adding to a table, you can use the WITH OWNERACCESS OPTION to enable the user to run a make-table or append query.

Owner access queries have two restrictions. First, you can’t change the owner of an owner access query. If you need to do this, you must remove the WITH OWNERACCESS clause, change the owner, and then change it back to an owner access query. Second, only the owner of an owner access query can save design changes to that query. If you have several developers who need to modify an owner access query, assign those developers to a group, and then make the group the owner of the query, using the steps previously described.