rich.barry
Registered User.
- Local time
- Today, 16:48
- Joined
- Aug 19, 2001
- Messages
- 176
A 2002 post from Pat says this:
I have a problem with a non-updatable query, which the root cause appears to be item 1, but the way I have set it up, there (as far as I can see) is no barrier to it being an updatable query.
What I have is a parent schedule table with a key of RunID.
A child table of this is my inventory table, each pack produced belonging to a specific RunID and having a production date.
When modifying the schedule, the query needs to show RunID's which have the most recent pack produced up to X days ago.
First Query is an aggregate query which groups by RunID and has Max in the production date field, plus a Where column to get those in the correct date range. Result is a list containing all the RunID's I'm interested in.
Second query is a join between the first query and the schedule table and gives the schedule information where the RunID in the 2 tables are equal.
This should be updatable, as nowhere is it ambiguous as to what RunID I want to update.
Unfortunately it is not updateable. Does anyone know why?
Thanks for the help
Richard
Queries are NEVER updatable if:
1. they contain aggregate functions such as Sum()
2. they are union queries
3. they contain a cross join
4. they are a cross tab
5. they contain a group by or distinct clause.
The reason that those query types are never updatable is because there is no way to identify an individual record. Ie, Jet can't take a row from the resulting recordset and identify its specific source row in a table because each row in the recordset is an amalgm of multipls source rows.
I have a problem with a non-updatable query, which the root cause appears to be item 1, but the way I have set it up, there (as far as I can see) is no barrier to it being an updatable query.
What I have is a parent schedule table with a key of RunID.
A child table of this is my inventory table, each pack produced belonging to a specific RunID and having a production date.
When modifying the schedule, the query needs to show RunID's which have the most recent pack produced up to X days ago.
First Query is an aggregate query which groups by RunID and has Max in the production date field, plus a Where column to get those in the correct date range. Result is a list containing all the RunID's I'm interested in.
Second query is a join between the first query and the schedule table and gives the schedule information where the RunID in the 2 tables are equal.
This should be updatable, as nowhere is it ambiguous as to what RunID I want to update.
Unfortunately it is not updateable. Does anyone know why?
Thanks for the help
Richard