N
Ngan
Last week, I asked about how to get a max record. Thanks
to those who helped me out. However, I forgot to explain
the real problem, using the max record query in an update
query.
I have a tblElig where a Client can have more than one
Elig record. I want to get the most current Elig record
(max of EffectiveTo date field). Here's what I did:
The first query (qryMaxEffTo) is a Totals query that finds
the Max(EffTo) for each ClientID (GroupBy).
The second query (qryMaxElig) has the first query
joined/linked to the underlying table (tblElig) by
ClientID and EffTo fields. I add EligStatus to the second
query to get other info.
Now I have a update query (qryUpdateClient) where I have
qryMaxElig and tblClient where ClientID and MaxEffTo in
qryMaxElig is joined to ClientID and EffTo in tblClient.
The update field would be EffTo and EligStatus of
tblClient. The "Update To" field would be the MaxEffto
and EligStatus of qryMaxElig.
When I try to run the update query, it says "Operation
must use an updatable query". I read the help file on
that. It says that it happens when the current query's
update to field includes a field from a select query in
which an aggregate (total) was calculated.
I need to do this update for all the clients, so in the
update to field, I can't have a DMax
("effto", "qryMaxElig", "ClientID=######") and do a
loop... It'll take forever to run.
Is there a way to do this?
Thanks.
Ngan
to those who helped me out. However, I forgot to explain
the real problem, using the max record query in an update
query.
I have a tblElig where a Client can have more than one
Elig record. I want to get the most current Elig record
(max of EffectiveTo date field). Here's what I did:
The first query (qryMaxEffTo) is a Totals query that finds
the Max(EffTo) for each ClientID (GroupBy).
The second query (qryMaxElig) has the first query
joined/linked to the underlying table (tblElig) by
ClientID and EffTo fields. I add EligStatus to the second
query to get other info.
Now I have a update query (qryUpdateClient) where I have
qryMaxElig and tblClient where ClientID and MaxEffTo in
qryMaxElig is joined to ClientID and EffTo in tblClient.
The update field would be EffTo and EligStatus of
tblClient. The "Update To" field would be the MaxEffto
and EligStatus of qryMaxElig.
When I try to run the update query, it says "Operation
must use an updatable query". I read the help file on
that. It says that it happens when the current query's
update to field includes a field from a select query in
which an aggregate (total) was calculated.
I need to do this update for all the clients, so in the
update to field, I can't have a DMax
("effto", "qryMaxElig", "ClientID=######") and do a
loop... It'll take forever to run.
Is there a way to do this?
Thanks.
Ngan