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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delete Multiple Records with Same ID 1

Status
Not open for further replies.

jsaliers

Programmer
Jan 23, 2003
129
US
That sounds bad, doesn't it? I have a database with a table named Transactions. This table contains records containing transaction information. For example, some records might be:

ID type amount
3456 A 25
1864 A 35
3456 B 10
3456 C 20
1985 A 15

I have another table called AcctInfo that has an overview, that is this table tracks the totals, dependent upon what transactions occur. Sample records:

ID total
3456 35
1864 35
1985 15

A form allows the user to look up the total from the AcctInfo table. They are then provided a button to delete the record. This means that the record must be deleted from both the AcctInfo table, and all associated records must be deleted from the Transactions table. I can delete the one record from the AcctInfo table, but cannot successfully delete ALL records associated by ID from the Transactions table. Any ideas?

Thanks in advance!!

Jon
 
Jon

You need to issue an SQL query:

DoCmd.RunSQL "DELETE FROM Transactions Where ID=" & Me!txtID

Replace "txtId" with the name of the control with the ID number in.
You can use "DoCmd.SetWarnings False"
beforehand and
"DoCmd.SetWarnings True"
afterwards to disable Access' built in query confirmation message.

John
 
Worked like a champ. Thanks very much for such prompt help!!!

Jon
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top