gbnorton
asked on
update query not updateable
I have a table with this data:
TubeNo PartNo ReceivedDate SerialNo JoinedDate
53556 PS512 1/1/12 00065 1/5/12
53556 PS512 3/1/12
64687 PS485 2/1/12
64687 PS485 4/1/12
I have this update query:
UPDATE MoxtekJoinTubes INNER JOIN qry_Update_JoinTubes_To_As sys_2 ON (MoxtekJoinTubes.Part_Numb er=qry_Upd ate_JoinTu bes_To_Ass ys_2.VmiPa rtNumber) AND (MoxtekJoinTubes.Tube_Seri al_Number= qry_Update _JoinTubes _To_Assys_ 2.SerialNu mber) SET qry_Update_JoinTubes_To_As sys_2.Assy _SerialNum ber = [MoxtekJoinTubes].[Assembl y_Serial_N umber], qry_Update_JoinTubes_To_As sys_2.Date _Joined = Date()
WHERE (((MoxtekJoinTubes.Compute r)=[Forms] ![frmJoin_ Tube_Moxte k]![txtCom puter]));
An operator scans in PartNo. Then scans in the group of SerialNo's and TubeNo's. This data goes into a temporary table(MoxtekJoinTubes). When SAVE is selected the TubeData table is updated via the query qry_Update_JoinTubes_To_As sys_2.
The query above updates all records for that TubeNo and PartNo.
But, I only want to update the records with most recent ReceivedDate. In the example above, if the current PartNo is PS512 with TubeNo 53556 then only the record with RecievedDate of 3/1/12 should be updated. The other left alone. If the current PartNo is PS485 with TubeNo 64687 then only the record with RecievedDate of 4/1/12 should be updated.
I created an additional query that using Totals and Last that selected the correct records. But Access won't let me use it with the Update query saying it is not updateable.
I need help creating a query that selects the records with the most recent RecievedDate that can be used with an Update query.
Thanks,
Brooks
TubeNo PartNo ReceivedDate SerialNo JoinedDate
53556 PS512 1/1/12 00065 1/5/12
53556 PS512 3/1/12
64687 PS485 2/1/12
64687 PS485 4/1/12
I have this update query:
UPDATE MoxtekJoinTubes INNER JOIN qry_Update_JoinTubes_To_As
WHERE (((MoxtekJoinTubes.Compute
An operator scans in PartNo. Then scans in the group of SerialNo's and TubeNo's. This data goes into a temporary table(MoxtekJoinTubes). When SAVE is selected the TubeData table is updated via the query qry_Update_JoinTubes_To_As
The query above updates all records for that TubeNo and PartNo.
But, I only want to update the records with most recent ReceivedDate. In the example above, if the current PartNo is PS512 with TubeNo 53556 then only the record with RecievedDate of 3/1/12 should be updated. The other left alone. If the current PartNo is PS485 with TubeNo 64687 then only the record with RecievedDate of 4/1/12 should be updated.
I created an additional query that using Totals and Last that selected the correct records. But Access won't let me use it with the Update query saying it is not updateable.
I need help creating a query that selects the records with the most recent RecievedDate that can be used with an Update query.
Thanks,
Brooks
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Queries are virtual tables. Upon occasion, if you save out a select query that presents the right records and give it a name (qrySomeRecords) you can get the update query
UPDATE qrySomeRecords SET qrySomeRecords.SomeField = someValue;
to work. The key, of course, is that the Totals field will for sure not be updateable.
It's worth trying!