PC Review


Reply
Thread Tools Rate Thread

Deleting Records from recordset

 
 
Bob Darlington
Guest
Posts: n/a
 
      5th Sep 2008
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


 
Reply With Quote
 
 
 
 
Alex Dybenko
Guest
Posts: n/a
 
      5th Sep 2008
Hi,
try to put table tBudgetNew as first one in join expression:

FROM tBudgetNew INNER JOIN qBOMACodesUnfiltered

--
Best regards,
___________
Alex Dybenko (MVP)
http://accessblog.net
http://www.PointLtd.com

"Bob Darlington" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>

 
Reply With Quote
 
Bob Darlington
Guest
Posts: n/a
 
      6th Sep 2008
Thanks Alex.
Tried that but still same result.

--
Bob Darlington
Brisbane
"Alex Dybenko" <(E-Mail Removed)> wrote in message
news:46A28C61-0EE7-445F-B2B7-(E-Mail Removed)...
> Hi,
> try to put table tBudgetNew as first one in join expression:
>
> FROM tBudgetNew INNER JOIN qBOMACodesUnfiltered
>
> --
> Best regards,
> ___________
> Alex Dybenko (MVP)
> http://accessblog.net
> http://www.PointLtd.com
>
> "Bob Darlington" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> 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
>>



 
Reply With Quote
 
Alex Dybenko
Guest
Posts: n/a
 
      6th Sep 2008
Hi,
then you can run delete query instead of .Delete

--
Best regards,
___________
Alex Dybenko (MVP)
http://accessblog.net
http://www.PointLtd.com


"Bob Darlington" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Thanks Alex.
> Tried that but still same result.
>
> --
> Bob Darlington
> Brisbane
> "Alex Dybenko" <(E-Mail Removed)> wrote in message
> news:46A28C61-0EE7-445F-B2B7-(E-Mail Removed)...
>> Hi,
>> try to put table tBudgetNew as first one in join expression:
>>
>> FROM tBudgetNew INNER JOIN qBOMACodesUnfiltered
>>
>> --
>> Best regards,
>> ___________
>> Alex Dybenko (MVP)
>> http://accessblog.net
>> http://www.PointLtd.com
>>
>> "Bob Darlington" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>> 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
>>>

>
>

 
Reply With Quote
 
Bob Darlington
Guest
Posts: n/a
 
      9th Sep 2008
Alex,
Correct. But I want to run a series of conditional tests on each record
before deleting.

--
Bob Darlington
Brisbane
"Alex Dybenko" <(E-Mail Removed)> wrote in message
news:uMJSDB$(E-Mail Removed)...
> Hi,
> then you can run delete query instead of .Delete
>
> --
> Best regards,
> ___________
> Alex Dybenko (MVP)
> http://accessblog.net
> http://www.PointLtd.com
>
>
> "Bob Darlington" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Thanks Alex.
>> Tried that but still same result.
>>
>> --
>> Bob Darlington
>> Brisbane
>> "Alex Dybenko" <(E-Mail Removed)> wrote in message
>> news:46A28C61-0EE7-445F-B2B7-(E-Mail Removed)...
>>> Hi,
>>> try to put table tBudgetNew as first one in join expression:
>>>
>>> FROM tBudgetNew INNER JOIN qBOMACodesUnfiltered
>>>
>>> --
>>> Best regards,
>>> ___________
>>> Alex Dybenko (MVP)
>>> http://accessblog.net
>>> http://www.PointLtd.com
>>>
>>> "Bob Darlington" <(E-Mail Removed)> wrote in message
>>> news:(E-Mail Removed)...
>>>> 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
>>>>

>>
>>



 
Reply With Quote
 
Alex Dybenko
Guest
Posts: n/a
 
      9th Sep 2008
Hi,
but you can still run tests, just run delete query, which deletes current
record instead of .Delete

--
Best regards,
___________
Alex Dybenko (MVP)
http://accessblog.net
http://www.PointLtd.com


"Bob Darlington" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Alex,
> Correct. But I want to run a series of conditional tests on each record
> before deleting.
>
> --
> Bob Darlington
> Brisbane
> "Alex Dybenko" <(E-Mail Removed)> wrote in message
> news:uMJSDB$(E-Mail Removed)...
>> Hi,
>> then you can run delete query instead of .Delete
>>
>> --
>> Best regards,
>> ___________
>> Alex Dybenko (MVP)
>> http://accessblog.net
>> http://www.PointLtd.com
>>
>>
>> "Bob Darlington" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>> Thanks Alex.
>>> Tried that but still same result.
>>>
>>> --
>>> Bob Darlington
>>> Brisbane
>>> "Alex Dybenko" <(E-Mail Removed)> wrote in message
>>> news:46A28C61-0EE7-445F-B2B7-(E-Mail Removed)...
>>>> Hi,
>>>> try to put table tBudgetNew as first one in join expression:
>>>>
>>>> FROM tBudgetNew INNER JOIN qBOMACodesUnfiltered
>>>>
>>>> --
>>>> Best regards,
>>>> ___________
>>>> Alex Dybenko (MVP)
>>>> http://accessblog.net
>>>> http://www.PointLtd.com
>>>>
>>>> "Bob Darlington" <(E-Mail Removed)> wrote in message
>>>> news:(E-Mail Removed)...
>>>>> 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
>>>>>
>>>
>>>

>
>

 
Reply With Quote
 
Bob Darlington
Guest
Posts: n/a
 
      12th Sep 2008
Thanks Alex, I'll do that.
Still curious to know why it didn't work through the recordset though.

--
Bob Darlington
Brisbane
"Alex Dybenko" <(E-Mail Removed)> wrote in message
news:e%(E-Mail Removed)...
> Hi,
> but you can still run tests, just run delete query, which deletes current
> record instead of .Delete
>
> --
> Best regards,
> ___________
> Alex Dybenko (MVP)
> http://accessblog.net
> http://www.PointLtd.com
>
>
> "Bob Darlington" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Alex,
>> Correct. But I want to run a series of conditional tests on each record
>> before deleting.
>>
>> --
>> Bob Darlington
>> Brisbane
>> "Alex Dybenko" <(E-Mail Removed)> wrote in message
>> news:uMJSDB$(E-Mail Removed)...
>>> Hi,
>>> then you can run delete query instead of .Delete
>>>
>>> --
>>> Best regards,
>>> ___________
>>> Alex Dybenko (MVP)
>>> http://accessblog.net
>>> http://www.PointLtd.com
>>>
>>>
>>> "Bob Darlington" <(E-Mail Removed)> wrote in message
>>> news:(E-Mail Removed)...
>>>> Thanks Alex.
>>>> Tried that but still same result.
>>>>
>>>> --
>>>> Bob Darlington
>>>> Brisbane
>>>> "Alex Dybenko" <(E-Mail Removed)> wrote in message
>>>> news:46A28C61-0EE7-445F-B2B7-(E-Mail Removed)...
>>>>> Hi,
>>>>> try to put table tBudgetNew as first one in join expression:
>>>>>
>>>>> FROM tBudgetNew INNER JOIN qBOMACodesUnfiltered
>>>>>
>>>>> --
>>>>> Best regards,
>>>>> ___________
>>>>> Alex Dybenko (MVP)
>>>>> http://accessblog.net
>>>>> http://www.PointLtd.com
>>>>>
>>>>> "Bob Darlington" <(E-Mail Removed)> wrote in message
>>>>> news:(E-Mail Removed)...
>>>>>> 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
>>>>>>
>>>>
>>>>

>>
>>



 
Reply With Quote
 
Alex Dybenko
Guest
Posts: n/a
 
      12th Sep 2008
Hi,
have a look here, perhaps same issue:
http://accessblog.net/2004/10/access...ql-in-jet.html

--
Best regards,
___________
Alex Dybenko (MVP)
http://accessblog.net
http://www.PointLtd.com


"Bob Darlington" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Thanks Alex, I'll do that.
> Still curious to know why it didn't work through the recordset though.
>
> --
> Bob Darlington
> Brisbane
> "Alex Dybenko" <(E-Mail Removed)> wrote in message
> news:e%(E-Mail Removed)...
>> Hi,
>> but you can still run tests, just run delete query, which deletes current
>> record instead of .Delete
>>
>> --
>> Best regards,
>> ___________
>> Alex Dybenko (MVP)
>> http://accessblog.net
>> http://www.PointLtd.com
>>
>>
>> "Bob Darlington" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>> Alex,
>>> Correct. But I want to run a series of conditional tests on each record
>>> before deleting.
>>>
>>> --
>>> Bob Darlington
>>> Brisbane
>>> "Alex Dybenko" <(E-Mail Removed)> wrote in message
>>> news:uMJSDB$(E-Mail Removed)...
>>>> Hi,
>>>> then you can run delete query instead of .Delete
>>>>
>>>> --
>>>> Best regards,
>>>> ___________
>>>> Alex Dybenko (MVP)
>>>> http://accessblog.net
>>>> http://www.PointLtd.com
>>>>
>>>>
>>>> "Bob Darlington" <(E-Mail Removed)> wrote in message
>>>> news:(E-Mail Removed)...
>>>>> Thanks Alex.
>>>>> Tried that but still same result.
>>>>>
>>>>> --
>>>>> Bob Darlington
>>>>> Brisbane
>>>>> "Alex Dybenko" <(E-Mail Removed)> wrote in message
>>>>> news:46A28C61-0EE7-445F-B2B7-(E-Mail Removed)...
>>>>>> Hi,
>>>>>> try to put table tBudgetNew as first one in join expression:
>>>>>>
>>>>>> FROM tBudgetNew INNER JOIN qBOMACodesUnfiltered
>>>>>>
>>>>>> --
>>>>>> Best regards,
>>>>>> ___________
>>>>>> Alex Dybenko (MVP)
>>>>>> http://accessblog.net
>>>>>> http://www.PointLtd.com
>>>>>>
>>>>>> "Bob Darlington" <(E-Mail Removed)> wrote in message
>>>>>> news:(E-Mail Removed)...
>>>>>>> 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
>>>>>>>
>>>>>
>>>>>
>>>
>>>

>
>

 
Reply With Quote
 
Bob Darlington
Guest
Posts: n/a
 
      14th Sep 2008
Thanks Alex, but was that the correct reference? It says nothing about
problems deleting from recordsets, which is my problem. I can get the delete
to work through a delete query without a problem.

--
Bob Darlington
Brisbane
"Alex Dybenko" <(E-Mail Removed)> wrote in message
news:en$Aa%(E-Mail Removed)...
> Hi,
> have a look here, perhaps same issue:
> http://accessblog.net/2004/10/access...ql-in-jet.html
>
> --
> Best regards,
> ___________
> Alex Dybenko (MVP)
> http://accessblog.net
> http://www.PointLtd.com
>
>
> "Bob Darlington" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> Thanks Alex, I'll do that.
>> Still curious to know why it didn't work through the recordset though.
>>
>> --
>> Bob Darlington
>> Brisbane
>> "Alex Dybenko" <(E-Mail Removed)> wrote in message
>> news:e%(E-Mail Removed)...
>>> Hi,
>>> but you can still run tests, just run delete query, which deletes
>>> current record instead of .Delete
>>>
>>> --
>>> Best regards,
>>> ___________
>>> Alex Dybenko (MVP)
>>> http://accessblog.net
>>> http://www.PointLtd.com
>>>
>>>
>>> "Bob Darlington" <(E-Mail Removed)> wrote in message
>>> news:(E-Mail Removed)...
>>>> Alex,
>>>> Correct. But I want to run a series of conditional tests on each record
>>>> before deleting.
>>>>
>>>> --
>>>> Bob Darlington
>>>> Brisbane
>>>> "Alex Dybenko" <(E-Mail Removed)> wrote in message
>>>> news:uMJSDB$(E-Mail Removed)...
>>>>> Hi,
>>>>> then you can run delete query instead of .Delete
>>>>>
>>>>> --
>>>>> Best regards,
>>>>> ___________
>>>>> Alex Dybenko (MVP)
>>>>> http://accessblog.net
>>>>> http://www.PointLtd.com
>>>>>
>>>>>
>>>>> "Bob Darlington" <(E-Mail Removed)> wrote in message
>>>>> news:(E-Mail Removed)...
>>>>>> Thanks Alex.
>>>>>> Tried that but still same result.
>>>>>>
>>>>>> --
>>>>>> Bob Darlington
>>>>>> Brisbane
>>>>>> "Alex Dybenko" <(E-Mail Removed)> wrote in message
>>>>>> news:46A28C61-0EE7-445F-B2B7-(E-Mail Removed)...
>>>>>>> Hi,
>>>>>>> try to put table tBudgetNew as first one in join expression:
>>>>>>>
>>>>>>> FROM tBudgetNew INNER JOIN qBOMACodesUnfiltered
>>>>>>>
>>>>>>> --
>>>>>>> Best regards,
>>>>>>> ___________
>>>>>>> Alex Dybenko (MVP)
>>>>>>> http://accessblog.net
>>>>>>> http://www.PointLtd.com
>>>>>>>
>>>>>>> "Bob Darlington" <(E-Mail Removed)> wrote in message
>>>>>>> news:(E-Mail Removed)...
>>>>>>>> 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
>>>>>>>>
>>>>>>
>>>>>>
>>>>
>>>>

>>
>>



 
Reply With Quote
 
Alex Dybenko
Guest
Posts: n/a
 
      14th Sep 2008
yes, sorry, I already forgot about original question, you have another issue

--
Best regards,
___________
Alex Dybenko (MVP)
http://accessblog.net
http://www.PointLtd.com


"Bob Darlington" <(E-Mail Removed)> wrote in message
news:#(E-Mail Removed)...
> Thanks Alex, but was that the correct reference? It says nothing about
> problems deleting from recordsets, which is my problem. I can get the
> delete to work through a delete query without a problem.
>
> --
> Bob Darlington
> Brisbane
> "Alex Dybenko" <(E-Mail Removed)> wrote in message
> news:en$Aa%(E-Mail Removed)...
>> Hi,
>> have a look here, perhaps same issue:
>> http://accessblog.net/2004/10/access...ql-in-jet.html
>>
>> --
>> Best regards,
>> ___________
>> Alex Dybenko (MVP)
>> http://accessblog.net
>> http://www.PointLtd.com
>>
>>
>> "Bob Darlington" <(E-Mail Removed)> wrote in message
>> news:(E-Mail Removed)...
>>> Thanks Alex, I'll do that.
>>> Still curious to know why it didn't work through the recordset though.
>>>
>>> --
>>> Bob Darlington
>>> Brisbane
>>> "Alex Dybenko" <(E-Mail Removed)> wrote in message
>>> news:e%(E-Mail Removed)...
>>>> Hi,
>>>> but you can still run tests, just run delete query, which deletes
>>>> current record instead of .Delete
>>>>
>>>> --
>>>> Best regards,
>>>> ___________
>>>> Alex Dybenko (MVP)
>>>> http://accessblog.net
>>>> http://www.PointLtd.com
>>>>
>>>>
>>>> "Bob Darlington" <(E-Mail Removed)> wrote in message
>>>> news:(E-Mail Removed)...
>>>>> Alex,
>>>>> Correct. But I want to run a series of conditional tests on each
>>>>> record before deleting.
>>>>>
>>>>> --
>>>>> Bob Darlington
>>>>> Brisbane
>>>>> "Alex Dybenko" <(E-Mail Removed)> wrote in message
>>>>> news:uMJSDB$(E-Mail Removed)...
>>>>>> Hi,
>>>>>> then you can run delete query instead of .Delete
>>>>>>
>>>>>> --
>>>>>> Best regards,
>>>>>> ___________
>>>>>> Alex Dybenko (MVP)
>>>>>> http://accessblog.net
>>>>>> http://www.PointLtd.com
>>>>>>
>>>>>>
>>>>>> "Bob Darlington" <(E-Mail Removed)> wrote in message
>>>>>> news:(E-Mail Removed)...
>>>>>>> Thanks Alex.
>>>>>>> Tried that but still same result.
>>>>>>>
>>>>>>> --
>>>>>>> Bob Darlington
>>>>>>> Brisbane
>>>>>>> "Alex Dybenko" <(E-Mail Removed)> wrote in
>>>>>>> message news:46A28C61-0EE7-445F-B2B7-(E-Mail Removed)...
>>>>>>>> Hi,
>>>>>>>> try to put table tBudgetNew as first one in join expression:
>>>>>>>>
>>>>>>>> FROM tBudgetNew INNER JOIN qBOMACodesUnfiltered
>>>>>>>>
>>>>>>>> --
>>>>>>>> Best regards,
>>>>>>>> ___________
>>>>>>>> Alex Dybenko (MVP)
>>>>>>>> http://accessblog.net
>>>>>>>> http://www.PointLtd.com
>>>>>>>>
>>>>>>>> "Bob Darlington" <(E-Mail Removed)> wrote in message
>>>>>>>> news:(E-Mail Removed)...
>>>>>>>>> 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
>>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>
>>>>>
>>>
>>>

>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Filter main form to records with no related records in subform,maintain updateable recordset esn Microsoft Access Form Coding 4 3rd Sep 2011 01:07 AM
Deleting half completed records and copying records questions wazza_c12@hotmail.com Microsoft Access 2 8th Jul 2006 01:39 AM
Deleting half completed records and copying records questions wazza_c12@hotmail.com Microsoft Access Forms 2 8th Jul 2006 01:39 AM
Deleting a group of records in a Recordset =?Utf-8?B?S21oQ29tcHV0ZXI=?= Microsoft Access Form Coding 1 3rd May 2006 04:07 AM
Re: ADO: Deleting records from duplicate recordset Tim Ferguson Microsoft Access VBA Modules 0 26th Apr 2004 05:54 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:24 PM.