简体   繁体   中英

Pass through Query Access/SQL to display data in a form

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.

  1. Create the passthrough query
  2. Create the form -- make it's datasource the passthrough query

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM