Reputation: 11
I've migrated my access database to SQL and having a tough time optimizing the database. I've read that a pass through query would speed things up but I'm stuck at running a pass through query that will retrieve data and place it in my form.
What I'd like to do is click a button (onclick event), have it run a pass-through query and open a form for editing. My limited knowledge says to create a macro for the onclick event that will open the form and run the necessary queries to fill the fields in my form. Am I barking up the wrong tree? I'd include some code but I don't know where to even start for help.
Update: The button's event procedure runs the openform command then the pass through query, but the query doesn't run. I've even just used a basic select * from table query and it says it cannot find the object. I then took the sql commands from the sqlout.txt and pasted them into the query with no luck.
Upvotes: 1
Views: 1584
Reputation: 13157
If you create a button to open the form, that's fine (do it from a menu, for example). But the form itself will run the query when it opens -- no code or macro required, as long as you set the datasource of the form to be the query.
FWIW-- you don't necessarily have to use a passthrough query. You can use linked tables instead, which allow you to create and modify queries using the visual designer. Passthrough queries are just plain sql / no visual designer.
Upvotes: 2