Pass criteria to a query design

C

Chris K

I have a letter merged to a query in my database

Depending upon a date chosen by the user I would like to pass that date as
criteria to my query

I can define the whole SQL statement:

With CurrentDb.QueryDefs("StdQuery")
.SQL = "SELECT [clients].* From [clients] WHERE [start date] >
Date() AND [Letter Sent] Is Null"
End With

but is it possible just to pass the criteria part?
 
A

Allen Browne

There's not a simple way to parse the WHERE clause from a query.

There may be tools available that do it, but there are many obstacles to
writing your own, such as delimiters (WHERE doesn't have to be delimited
with spaces), subqueries, and the fact that JET allows reserved words (such
as WHERE) in other places (such as field names or parameters.)
 
D

David W. Fenton

There may be tools available that do it, but there are many
obstacles to writing your own, such as delimiters (WHERE doesn't
have to be delimited with spaces), subqueries, and the fact that
JET allows reserved words (such as WHERE) in other places (such as
field names or parameters.)

....As well as there possibly being subqueries anywhere (in the
SELECT, the FROM or the WHERE clause).
 

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

Top