followup question on updating un-updateable queries

G

Guest

Per Roger's suggestion, I've converted a count query to a table and then used
that table to do an update. The issue I have now is the count query and the
criteria of the dates.

Here's a history of what I have: a table tblNoShow that lists the times a
client doesn't show up for an appt. Currently, the count make table query
looks like:
INSERT INTO NoShowIDs ( AUX_CLIENT_ID )
SELECT DISTINCT AUX_CLIENT_ID FROM tblNoShow
WHERE Invalid = 0 and DUE_TIME Between DateAdd('d',-60,Date()) AND DATE()+1
GROUP BY AUX_CLIENT_ID HAVING Count(AUX_CLIENT_ID)>1 And Count
(AUX_CLIENT_ID) < 6 ORDER BY AUX_CLIENT_ID

The second query that updates based on this new table is:

UPDATE tblNoShow SET LetterPrintDate = Date(), LetterPrintBy = username()
WHERE AUX_CLIENT_ID In (SELECT AUX_CLIENT_ID FROM NoShowIDs) AND
LetterPrintDate Is Null AND DUE_TIME Between Date()-60 And Date()

Well, the issue now is the criteria for the date range of the DUE_TIME.
Currently, I have the criteria to be between the current date and 60 days
from the current date. The manager now wants it to be between the current
date and 60 days from the LAST NOSHOW DATE (max of due_time for that
particular client).

So it looks like a subquery within a subquery :(

Is there a way to do it where it wouldn't take time to run the query? I
know subqueries and dmax functions take time to run.
 
G

Guest

I think I found the answer. I created a qryMaxDueTime and linked it to my
count query. Works great.
 

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