Search code examples
sqlvisual-studioms-accessserver-explorer

How do I give myself read permission for a local Access table?


I'm trying to see if my SQL statement (MS Access) does what it should in Visual Studio by creating a connection to it and then running the query in the Server Explorer.

I want to find out if there's any difference between these two queries:

SELECT        duckbill_.id, duckbill_.pack_size, duckbill_.description, duckbill_.vendor_id, duckbill_.department, duckbill_.subdepartment, duckbill_.unit_cost, duckbill_.unit_list, duckbill_.open_qty, duckbill_.UPC_code, 
                         duckbill_.UPC_pack_size, duckbill_.crv_id, duckbill__vendors.vendor_item
FROM            duckbill_, duckbill__vendors
WHERE        (duckbill_.vendor_id = duckbill__vendors.vendor_id)

and:

SELECT        duckbill_.id, duckbill_.pack_size, duckbill_.description, duckbill_.vendor_id, duckbill_.department, duckbill_.subdepartment, duckbill_.unit_cost, duckbill_.unit_list, duckbill_.open_qty, duckbill_.UPC_code, 
                         duckbill_.UPC_pack_size, duckbill_.crv_id, duckbill__vendors.vendor_item
FROM            (duckbill_ LEFT OUTER JOIN
                         duckbill__vendors ON duckbill_.vendor_id = duckbill__vendors.vendor_id)

...but it won't even let me execute the query. I can connect to the database, but apparently not to the individual tables. I get this error:

*SQL Execution Error
<My SQL statement>
Error Message: Record(s) cannot be read; no read permission on 'duckbill_'.*

How can I solve that?


Solution

  • I still wanted to do this in Visual Studio's server explorer (or any other Jet query tool). Here's what I did to fix it:

    1. Shift + double click the mdb file
    2. Go to the Database Tools tab
    3. Click Users and Permissions > User and Group Permissions
      • If no users show up here, you may first need to visit Users and Permissions > User and Group Accounts to create one.
    4. Select the Admin user which I connect with
    5. Under "Object Name:" click the top item, then shift click the last table to select them all
    6. Click all permissions check boxes (or the read-only ones, if you prefer)
    7. Apply; close Access.

    Now Visual Studio's Server Explorer was able to connect and run queries under the "Admin" user.