Changing a duplicate select query into a delete query, help!!

J

JC

Hello,

I am trying to change a select, find duplicates, query into a delete
query. I want to get rid of the records in the main table
"tblHurnsHistory." I changed the Find Duplicates query to a Delete
query. I then received an input box looking for criteria that
states,"

Enter parameter value
qryHurnsHistory.Grads_creditsEarned

Then it deletes 0 records. I need it to delete the 48 that the Find
Duplicates query returned.

I am a little rusty at SQL, can you help me so the following SQL
deletes the records returned by the FindDuplicates query.


DELETE HHDelete.SyStudentID, HHDelete.Grads_creditsEarned, HHDelete.ID,
HHDelete.StudentName, HHDelete.SSN, HHDelete.adTrmCode,
HHDelete.GPA_creditsEarned, HHDelete.StatusDesc, HHDelete.StatusDate,
HHDelete.LDA, HHDelete.ProgVersCode, HHDelete.TermCode,
HHDelete.term_credits, HHDelete.TotalCrd, HHDelete.creditsAttempt,
HHDelete.GPA, HHDelete.CreditsRemaining, HHDelete.SumOfReceived,
HHDelete.SumOfRefunded, HHDelete.FundSource
FROM tblHurnsHistory AS HHDelete
WHERE (((HHDelete.SyStudentID) In (SELECT [SyStudentID] FROM
[qryHurnsHistory] As Tmp GROUP BY [SyStudentID],[Grads_creditsEarned]
HAVING Count(*)>1 And [Grads_creditsEarned] =
[qryHurnsHistory].[Grads_creditsEarned])));


Thanks in advance,

Justin
 
G

Guest

Well I do not think you can not use one query to do both.

You would have another problem if it would work in that the query would
delete all records that were duplicate. You ned to run a make table and
decide which of the matching records is to be deleted and which is to remain.
 

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