Can a user edit an SQL database by editing the results of a Pass Through query in Access?

49 Views Asked by At

First off, I am a novice or grazing intermediate when it comes to MS Access and SQL Server so if this seems like a odd question please keep that in mind. This is also my first time posting on stack overflow.

I'll keep it simple, we have a user that uses an Access database to check on the quality of the data on our SQL server. It is filled currently with Linked tables to the SQL Server and queries based off those linked tables. They need another query for their work and instead of using a query based on linked tables this time, I thought maybe I would use a pass through query as it might work better and be safer. They never need to make edits to data from Access.

My question is can the user edit the tables used in the pass through query by accident from the query's results in Access. Correct me if I'm wrong, but currently the user could accidently edit the main tables using the queries results based on the linked tables. If PT query results cannot change the main tables I might go change those others to PTs...

I don't have any code or problems to post here. Just the general question above.

1

There are 1 best solutions below

0
Albert D. Kallal On

As noted, a pass-though query is read only.

However, you can create a view in SQL server. They perform usually just as well as a pass-though query anyway.

And you can then from Access link to that view, and the results are read/write. In fact, you can even bind a form directly to such linked views, and thus edit data from SQL server, and no code is required.

Do note that when you create a view in SQL server, and then link from Access client?

You WILL be prompted for a PK column value when you link, and you MUST choose the PK from the table for above to work.

On the other hand since a view is quite a bit less effort then a pass-though query, then if you do NOT choose the PK value when linking to the view, then the view will be read only.