queries in codes

  • Thread starter Thread starter papa jonah
  • Start date Start date
P

papa jonah

Can I take a sql query statement and insert it into code? I know that
on any sort of event such as "on focus" or "on click" I can run a
query. I want to have code run a query within certain parameters as
determined by if...then statements.

For example, I want to put the actual directions of a query (maybe that
means the SQL) into the code amongst an If...then statement that can
influence the criteria for the query without having to have several
queries for different conditions that the if....then would point to.
 
The answer requires knowing if this is a select query, like for a report or
form, or an Action query.

If an Action query, then something like
CurrentDB.Execute "Select * from ..."

If for a report, then
docmd.openreport "reportname", where:="Id = " & txtID

Which way are we headed?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Back
Top