Deleting Records from recordset
- From: "Bob Darlington" <bob@xxxxxxxxxxxxxxxxxxxx>
- Date: Fri, 5 Sep 2008 17:23:19 +1000
I want to delete certain records from a recordset using:
Set rsBudNew = db.OpenRecordset("SELECT tBudgetNew.* FROM
qBOMACodesUnfiltered INNER JOIN tBudgetNew" _
& " ON qBOMACodesUnfiltered.BOMAID =
tBudgetNew.BOMACounter WHERE PropNum = " & gblPropNum)
With rsBudNew
Do Until .EOF
if ...... then .Delete
.MoveNext
Loop
End With
The recordset is updatable.
But it generates an error saying that there are related records in another
table.
tBudgetNew has no relationship with the table in the error message.
There is a one to many relationship between a table in qBOMACodes and
tBudgetNew
If I run:
db.Execute "DELETE tBudgetNew.* " _
& " FROM qBOMACodesUnfiltered " _
& " INNER JOIN tBudgetNew ON qBOMACodesUnfiltered.BOMAID =
tBudgetNew.BOMACounter " _
& " WHERE qBOMACodesUnfiltered.PropNum= " & gblPropNum,
dbFailOnError
all the records are deleted without a problem.
Can anyone tell me what I'm missing here.
--
Bob Darlington
Brisbane
.
- Follow-Ups:
- Re: Deleting Records from recordset
- From: Alex Dybenko
- Re: Deleting Records from recordset
- Prev by Date: Re: Email current record
- Next by Date: Re: Localizing SQL Server Data
- Previous by thread: Populating HTML file with data from table
- Next by thread: Re: Deleting Records from recordset
- Index(es):