472,354 Members | 1,484 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,354 software developers and data experts.

Select qry works - delete qry fails

ms
Why does this select query return the correct records but when I make it a
delete query I get a msgbox with "Could not delete from specified
tables".

SELECT BMIDLog.*
FROM stageBMIDLog INNER JOIN BMIDLog ON (BMIDLog.BattID = stageBMIDLog.BattID)
AND (BMIDLog.VehicleID = stageBMIDLog.VehicleID) AND (BMIDLog.TotalChgAhs =
stageBMIDLog.TotalChgAhs)

DELETE BMIDLog.*
FROM stageBMIDLog INNER JOIN BMIDLog ON (BMIDLog.BattID = stageBMIDLog.BattID)
AND (BMIDLog.VehicleID = stageBMIDLog.VehicleID) AND (BMIDLog.TotalChgAhs =
stageBMIDLog.TotalChgAhs)

Thanks

Nov 12 '05 #1
5 1706
I suspect it is because you've joined table together... I don't think you
can't delete records this way.

You should delete from one table and set up the relationships so the delete
will cascade to any associated tables.
--
Bradley
Software Developer www.hrsystems.com.au
A Christian Response www.pastornet.net.au/response

"ms" <ms@nospam.comcast.net> wrote in message
news:9t********************@comcast.com...
Why does this select query return the correct records but when I make it a
delete query I get a msgbox with "Could not delete from specified
tables".

SELECT BMIDLog.*
FROM stageBMIDLog INNER JOIN BMIDLog ON (BMIDLog.BattID = stageBMIDLog.BattID) AND (BMIDLog.VehicleID = stageBMIDLog.VehicleID) AND (BMIDLog.TotalChgAhs = stageBMIDLog.TotalChgAhs)

DELETE BMIDLog.*
FROM stageBMIDLog INNER JOIN BMIDLog ON (BMIDLog.BattID = stageBMIDLog.BattID) AND (BMIDLog.VehicleID = stageBMIDLog.VehicleID) AND (BMIDLog.TotalChgAhs = stageBMIDLog.TotalChgAhs)

Thanks

Nov 12 '05 #2
ms
Thanks Bradley, but won't confuses me is, why does this Delete query work then?
What makes a join query in a delete statement work?

DELETE stageChargeLog.*
FROM ChargeLog INNER JOIN stageChargeLog ON
([ChargeLog].[STTIME]=[stageChargeLog].[STTIME]) AND
([ChargeLog].[STDATE]=[stageChargeLog].[STDATE]) AND
([ChargeLog].[BattID]=[stageChargeLog].[BattID]);
Bradley wrote:
I suspect it is because you've joined table together... I don't think you
can't delete records this way.

You should delete from one table and set up the relationships so the delete
will cascade to any associated tables.


Nov 12 '05 #3
ms
I also followed Access Help (Delete records from one table or tables in a
one-to-one (and one-to-many) relationship) using the query design window and
still it works as a select but fails as a Delete. No information, no help,
nothing. Just says can't delete.
This is what the query design query is in SQL:

DELETE stageBMIDLog.*
FROM stageBMIDLog, TMPstageBMIDLog
WHERE TMPstageBMIDLog.TotalChgAhs=[stageBMIDLog].[TotalChgAhs] AND
TMPstageBMIDLog.VehicleID=[stageBMIDLog].[vehicleid] AND
TMPstageBMIDLog.BattID=[stageBMIDLog].[battid];
ms wrote:
Thanks Bradley, but won't confuses me is, why does this Delete query
work then? What makes a join query in a delete statement work?

DELETE stageChargeLog.*
FROM ChargeLog INNER JOIN stageChargeLog ON
([ChargeLog].[STTIME]=[stageChargeLog].[STTIME]) AND
([ChargeLog].[STDATE]=[stageChargeLog].[STDATE]) AND
([ChargeLog].[BattID]=[stageChargeLog].[BattID]);
Bradley wrote:
I suspect it is because you've joined table together... I don't think you
can't delete records this way.

You should delete from one table and set up the relationships so the
delete
will cascade to any associated tables.



Nov 12 '05 #4
ms
I figured this out - enough to get my job done:
The delete query with a JOIN works when using .Execute from code vs. from the
object window.
Don't know why though.
Thanks,
mark

ms wrote:
I also followed Access Help (Delete records from one table or tables in
a one-to-one (and one-to-many) relationship) using the query design
window and still it works as a select but fails as a Delete. No
information, no help, nothing. Just says can't delete.
This is what the query design query is in SQL:

DELETE stageBMIDLog.*
FROM stageBMIDLog, TMPstageBMIDLog
WHERE TMPstageBMIDLog.TotalChgAhs=[stageBMIDLog].[TotalChgAhs] AND
TMPstageBMIDLog.VehicleID=[stageBMIDLog].[vehicleid] AND
TMPstageBMIDLog.BattID=[stageBMIDLog].[battid];
ms wrote:
Thanks Bradley, but won't confuses me is, why does this Delete query
work then? What makes a join query in a delete statement work?

DELETE stageChargeLog.*
FROM ChargeLog INNER JOIN stageChargeLog ON
([ChargeLog].[STTIME]=[stageChargeLog].[STTIME]) AND
([ChargeLog].[STDATE]=[stageChargeLog].[STDATE]) AND
([ChargeLog].[BattID]=[stageChargeLog].[BattID]);
Bradley wrote:
I suspect it is because you've joined table together... I don't think
you
can't delete records this way.

You should delete from one table and set up the relationships so the
delete
will cascade to any associated tables.



Nov 12 '05 #5
ms
I figured this out - enough to get my job done:
The delete query with a JOIN works when using .Execute from code vs. from the
object window.
Don't know why though.
Thanks,
mark

ms wrote:
I also followed Access Help (Delete records from one table or tables in
a one-to-one (and one-to-many) relationship) using the query design
window and still it works as a select but fails as a Delete. No
information, no help, nothing. Just says can't delete.
This is what the query design query is in SQL:

DELETE stageBMIDLog.*
FROM stageBMIDLog, TMPstageBMIDLog
WHERE TMPstageBMIDLog.TotalChgAhs=[stageBMIDLog].[TotalChgAhs] AND
TMPstageBMIDLog.VehicleID=[stageBMIDLog].[vehicleid] AND
TMPstageBMIDLog.BattID=[stageBMIDLog].[battid];
ms wrote:
Thanks Bradley, but won't confuses me is, why does this Delete query
work then? What makes a join query in a delete statement work?

DELETE stageChargeLog.*
FROM ChargeLog INNER JOIN stageChargeLog ON
([ChargeLog].[STTIME]=[stageChargeLog].[STTIME]) AND
([ChargeLog].[STDATE]=[stageChargeLog].[STDATE]) AND
([ChargeLog].[BattID]=[stageChargeLog].[BattID]);
Bradley wrote:
I suspect it is because you've joined table together... I don't think
you
can't delete records this way.

You should delete from one table and set up the relationships so the
delete
will cascade to any associated tables.



Nov 12 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Will Potter | last post by:
I just inherited support of this app so bear with me. The scenario: Oracle 9i replicated databases, same C++ server process runs on both boxes. On a 15 minute schedule, the server that is primary...
17
by: kalamos | last post by:
This statement fails update ded_temp a set a.balance = (select sum(b.ln_amt) from ded_temp b where a.cust_no = b.cust_no and a.ded_type_cd = b.ded_type_cd and a.chk_no = b.chk_no group by...
11
by: Stefan Finzel | last post by:
Hi trying to remove one or all elements of select options fails for Pocket Internet Explorer. Is there a way to do this? if is_PIE { // this does not work on Pocket IE while (opt.length) {...
5
by: Robert Creager | last post by:
I'm using 7.4b4 with domains, and am having a problem with selecting without casting. create domain test_domain as integer check( (value notnull) and (value >= 1) ); create table test_table(...
9
by: Robert Schneider | last post by:
Hi to all, I don't understand that: I try to delete a record via JDBC. But I always get the error SQL7008 with the error code 3. It seems that this has something to do with journaling, since the...
3
by: William Wisnieski | last post by:
Hello Again, I'm really stuck on this one.....so I'm going to try a different approach to this problem. I have a query by form that returns a record set in a datasheet. The user double...
8
by: Bob Day | last post by:
using vs 2003 ... This works fine Select Case 350 Case 300 To 399 Stop End Select This fails with no warning Select Case 520
6
by: yc022 | last post by:
Hi all, this is my first time using this so i'm not really sure how it works. please bear with me. i am trying to delete a row in a database using a select list. First of all i have a query to...
1
by: WayneClements | last post by:
Does anyone know why a simple select like : SELECT SettingValue FROM sysCONFIG_SETTINGS WHERE ModuleName = N'ScheduledTask' AND SettingKey = N'Logon' should fail in oracle 10g It fails with...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made but the http to https rule only works for...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
2
by: Matthew3360 | last post by:
Hi, I have a python app that i want to be able to get variables from a php page on my webserver. My python app is on my computer. How would I make it so the python app could use a http request to get...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and credentials and received a successful connection...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.