Passing parameters to MS Access query?
Posted on 2004-09-01
How can I pass parameters to an MS-Access query?
I have queries located in an Access database that require parameters as input. When you run one of these queries in Access, it prompts for each parameter before running. How can I pass these parameters to the Access query directly from Delphi 3 and retrieve the resulting dataset in Dephi.
I know I can copy the SQL from Access into a Tquery component at design time and supply the parameters at run time that way. I tried that and it does work, but I’d like to keep my design layered such that the query logic (SQL) remains inside the Access database. This way when the database structure changes, I don’t necessarily need to change my code. Additionally, many of these queries are quite complex and it is a serious waste of time to touch them twice.
Any input would be appreciated.