A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Prevent duplicate append - nothing unique



 
 
Thread Tools Display Modes
  #1  
Old December 2nd, 2009, 09:03 PM posted to microsoft.public.access.queries
Opal[_3_]
external usenet poster
 
Posts: 133
Default Prevent duplicate append - nothing unique

Help! I have been working on this all day and
cannot get my head around a solution....
I am running Access 2003.

I have created the following select query:

SELECT ScrapData.ScrapDate, ScrapData.PartNo, ScrapData.Description,
ScrapData.CostCtr, ScrapData.Value
FROM ScrapData
GROUP BY ScrapData.ScrapDate, ScrapData.PartNo,
ScrapData.Description, ScrapData.CostCtr, ScrapData.Value,
HAVING (((ScrapData.ScrapDate) Between
[Forms]![frmSelectCMCC]![FromDate] And [Forms]![frmSelectCMCC]!
[ToDate]))
ORDER BY ScrapData.ScrapDate;

called "qryPart1CM" from there, I have created
an append query to my countermeasure table:

INSERT INTO Countermeasure ( PartNo, Description, Cost, CostCtr,
WeekNo )
SELECT TOP 3 qryPart1CM.PartNo, qryPart1CM.Description,
Sum(qryPart1CM.Value) AS Cost, qryPart1CM.CostCtr, qryPart1CM.WeekNo
FROM qryPart1CM
GROUP BY qryPart1CM.PartNo, qryPart1CM.Description,
qryPart1CM.CostCtr, qryPart1CM.WeekNo
HAVING (((qryPart1CM.CostCtr)=[Forms]![frmSelectCMCC]![cboCC]))
ORDER BY Sum(qryPart1CM.Value) DESC;

Basically, each user responsible for a specific "CostCtr"
must enter countermeasures for Scrap data on a weekly
basis. The countermeasures are for the "Top 3" scrap
parts by value. I cannot open the form based on the
query as it is not updatable, so I thought I would run
an append query to a table and bind my form to it. However,
I need to prevent duplication to the "Countermeasure" table
and cannot figure out a way to create a unique field to accomplish
this.... Can anyone help?
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 02:16 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.