Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Deleting from a recordset

Status
Not open for further replies.

PANIk

Programmer
Apr 22, 2002
7
0
0
AU
I have two tables Category and Locator. Locator references Category through Category_ID.

Now to get from the Locator table I do a simple select

SELECT * FROM [Locator] JOIN [Category] ON [Category].[Category_ID] = [Locator].[Category_ID]

Now through ADO When I use the find method Locator_ID and then call the Delete method. It not only deletes from the Locator table but also the Category that it was referencing. There are no constraints for cascading deletes (I made sure of that)

What could be the problem. I tried it through SQL server and it gives me the desired effect.

Thanx
 
Dear PANIK,

in fact your statement does exactly what you tell it to do.

with

SELECT * -- take all fields

FROM [Locator] JOIN [Category]
--- from both tables
ON [Category].[Category_ID]
= [Locator].[Category_ID]

now if you delete you delete from both tables.

what you could do is if you have your Locator_ID in hand.

yourConnection.execute ("Delete * from [Locator] where Locator_ID = " & your_variable)

HTH

regards Astrid

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top