Delete A Group of Records from a Form

MarcieFess

Registered User.
Local time
Today, 14:20
Joined
Oct 25, 2012
Messages
107
Hi all.

I would like some help in solving a problem.

I have a main menu that uses 2 combo boxes to choose a company, then a specific store within that company, to manipulate store information and print store-specific reports.

The client would like me to add a button with an "on click" event that will delete all of the products in a specific store.

This company does annual reports for their clients, and this company must refresh inventory data. They import Excel spreadsheets, and they want to be sure that the import procedure doesn't skip records that already exist, so the best way to do this (in their minds) is to delete all store product records and start from scratch. Not knowing enough about other possibilities myself, I agreed to try.

I created a delete records query:

Code:
DELETE tblStoreProducts.StoreProductKey, tblStoreProducts.UPC, tblStoreProducts.StoreKey, tblStoreProducts.Cases, tblStoreProducts.Storage, tblStoreProducts.Use, tblStoreProducts.AnnualWaste, tblStoreProducts.ProductKey
FROM tblStoreProducts
WHERE (((tblStoreProducts.StoreProductKey)=[Forms]![frmChooseStore]![cboStore]));

But, Access 2010 won't allow me to make this query an event on a button.

Any suggestions?
 
Can you make it a saved query and on the click event of a button: DoCmd.OpenQuery "qrydelete" (replace qrydelete with the actual name)

Catalina
 
I tried that. I'm getting the following error:

Wrong # of arguments or invalid property assignment.
 

Users who are viewing this thread

Back
Top Bottom