r/MicrosoftAccess • • Jun 13 '19

Pass-through queries vs. native SQL Server views?

My back-end data is all on SQL Server. My front-end application is VBA-heavy (no macros, much code). One of the main forms for the system uses a pass-through query, because I need to change its sql property from time to time based on user choices/behavior -- after changing the previous SQL, the form is then requeried, voila, fresh data. This works fine for the number of users and quantity of data in question.

But it's frankly a PITA to maintain the pass-through query. I'd much rather use a real SQL Server view, which I can alter during testing much more easily than I can accomplish the same thing via Access.

So... Given a linked SQL Server view, can I alter its SQL dynamically, as required, using VBA?

Thanks for any brainstorms!

1 Upvotes

1 comment sorted by

2

u/bnelson333 Jun 14 '19

Once you go passthrough you won't want to go back. It's a million times faster and it just works.

Is this a distributed front end or are multiple users hitting the same file on a network drive? Because if it's the latter you shouldn't be (or can't?) be changing the source of an underlying non-pass through query via VBA. You could tie the criteria to something in a form then as the user changes the form, it changes the query because the query is tied to the form. But problematically changing the underlying SQL is especially dangerous in a multi user environment.

My philosophy about multi user application is unfortunately a little bit on the minority side: I prefer it to be a pain in the ass for the developers if it makes it easier for the users. From a pure utility argument, if it takes me 10 hours to implement a change but it saves 100 users 10 minutes, over time, it will have been worth it. Besides, I'd really rather do it right and not have 100 users complaining to me that their thing is broken.