Can this be done?

  • Thread starter Thread starter Bob V
  • Start date Start date
B

Bob V

My DB contains a Table tblOwnerInfo which contains OwnerName & OwnerID
Also tblInvoice has Invoices which have OwnerID
Also tbPayments has payments with OwnerID
Can I create a Query with a drop down list so when On Click it will delete
all Invoices and Payments with the same OwnerID
Thanks for any Help..................Bob
 
Can be done using a form with ComboBox to select OwnerID and a button to run
the code that delete the records

But first, BACKUP your data.
********************************
The code to delete the records, look like:

CurrentDb.Execute("Delete * From tblInvoice Where OwnerID = " &
Me.[ComboName]), dbFailOnError
CurrentDb.Execute("Delete * From tbPayments Where OwnerID = " &
Me.[ComboName]), dbFailOnError

*******************
If the OwnerID field is text, you will need to add single quote before and
after the value
CurrentDb.Execute("Delete * From tblInvoice Where OwnerID = '" &
Me.[ComboName] & "'"), dbFailOnError
CurrentDb.Execute("Delete * From tbPayments Where OwnerID = '" &
Me.[ComboName] & "'"), dbFailOnError
 
Thanks Ofer worked Brilliant!.......Regards Bob

Ofer Cohen said:
Can be done using a form with ComboBox to select OwnerID and a button to
run
the code that delete the records

But first, BACKUP your data.
********************************
The code to delete the records, look like:

CurrentDb.Execute("Delete * From tblInvoice Where OwnerID = " &
Me.[ComboName]), dbFailOnError
CurrentDb.Execute("Delete * From tbPayments Where OwnerID = " &
Me.[ComboName]), dbFailOnError

*******************
If the OwnerID field is text, you will need to add single quote before and
after the value
CurrentDb.Execute("Delete * From tblInvoice Where OwnerID = '" &
Me.[ComboName] & "'"), dbFailOnError
CurrentDb.Execute("Delete * From tbPayments Where OwnerID = '" &
Me.[ComboName] & "'"), dbFailOnError

--
Good Luck
BS"D


Bob V said:
My DB contains a Table tblOwnerInfo which contains OwnerName & OwnerID
Also tblInvoice has Invoices which have OwnerID
Also tbPayments has payments with OwnerID
Can I create a Query with a drop down list so when On Click it will
delete
all Invoices and Payments with the same OwnerID
Thanks for any Help..................Bob
 
Ofer can this be altered to only Delete the InvoiceID that is highlighted in
a continuous form, from a Query?
Thanks Bob

Bob V said:
Thanks Ofer worked Brilliant!.......Regards Bob

Ofer Cohen said:
Can be done using a form with ComboBox to select OwnerID and a button to
run
the code that delete the records

But first, BACKUP your data.
********************************
The code to delete the records, look like:

CurrentDb.Execute("Delete * From tblInvoice Where OwnerID = " &
Me.[ComboName]), dbFailOnError
CurrentDb.Execute("Delete * From tbPayments Where OwnerID = " &
Me.[ComboName]), dbFailOnError

*******************
If the OwnerID field is text, you will need to add single quote before
and
after the value
CurrentDb.Execute("Delete * From tblInvoice Where OwnerID = '" &
Me.[ComboName] & "'"), dbFailOnError
CurrentDb.Execute("Delete * From tbPayments Where OwnerID = '" &
Me.[ComboName] & "'"), dbFailOnError

--
Good Luck
BS"D


Bob V said:
My DB contains a Table tblOwnerInfo which contains OwnerName & OwnerID
Also tblInvoice has Invoices which have OwnerID
Also tbPayments has payments with OwnerID
Can I create a Query with a drop down list so when On Click it will
delete
all Invoices and Payments with the same OwnerID
Thanks for any Help..................Bob
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Enter Date on Emailing 6
Sending Report via Email 3
Ok This one is Tuff 3
Field Size Dilemma 12
Using a Check Box as a Condition 4
Can This be Done! 10
Adding True/False condition to my code 2
Table Query! 5

Back
Top