Hi,
I have two queries: "qryHistoryPers onIDs" that just contains the
"personID" numeric field, and "qryDonatio ns" that just contains the
"personID" field, and a date field ("dDonationDate ").
I want to delete every record in the qryHistoryPerso nIDs recordset
that are not found in the qryDonations recordset for a particular date
range.
I have tried:
DoCmd.RunSQL "Delete * From qryHistoryPerso nIDs Where
qryHistoryPerso nIDs.personID Not In (Select qryDonations.pe rsonid From
qryDonations Where tblDonations.[DonationDate] Not Between #" &
dFromDate_pw & "# And #" & dToDate_pw & "# )"
But it is very slow and locks up Access.
I have also tried:
DoCmd.RunSQL "Delete * From qryHistoryPerso nIDs LEFT JOIN
qryDonations ON qryHistoryPerso nIDs.PersonID = tblDonations.Pe rsonID
WHERE qryDonations.[DonationDate] Not Between #" & dFromDate_pw & "#
And #" & dToDate_pw & "#"
I populate dFromDate_pw and dToDate_pw with dates entered on a form.
But I am getting "Specify the table containing the records you want to
delete". Can't figure it out.
Any ideas?
-pw
use paulwilliamson at spamcop dot net for e-mail
I have two queries: "qryHistoryPers onIDs" that just contains the
"personID" numeric field, and "qryDonatio ns" that just contains the
"personID" field, and a date field ("dDonationDate ").
I want to delete every record in the qryHistoryPerso nIDs recordset
that are not found in the qryDonations recordset for a particular date
range.
I have tried:
DoCmd.RunSQL "Delete * From qryHistoryPerso nIDs Where
qryHistoryPerso nIDs.personID Not In (Select qryDonations.pe rsonid From
qryDonations Where tblDonations.[DonationDate] Not Between #" &
dFromDate_pw & "# And #" & dToDate_pw & "# )"
But it is very slow and locks up Access.
I have also tried:
DoCmd.RunSQL "Delete * From qryHistoryPerso nIDs LEFT JOIN
qryDonations ON qryHistoryPerso nIDs.PersonID = tblDonations.Pe rsonID
WHERE qryDonations.[DonationDate] Not Between #" & dFromDate_pw & "#
And #" & dToDate_pw & "#"
I populate dFromDate_pw and dToDate_pw with dates entered on a form.
But I am getting "Specify the table containing the records you want to
delete". Can't figure it out.
Any ideas?
-pw
use paulwilliamson at spamcop dot net for e-mail
Comment