Can this be done?

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
 
O

Ofer Cohen

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
 
B

Bob V

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
 
B

Bob V

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
 
Top