Delete Query.

BillBee

Registered User.
Local time
Today, 06:02
Joined
Aug 31, 2008
Messages
137
I am not sure if I am in the right area to ask this question. In the application I am working on is a Show Program and I need to delete data from 3 tables each year. I can go to Tables, Select All and Delete or I can Create a Delete Query and Run the query and answer yes to the two message boxes to remove the data. I tried to run the Delete Query from both a Command button and from a Macro but both of these procedures do not seem to work allow this to work this way. Is there any way I can remove the data other than the methods mentioned above.
 
If your delete query is created and saved it will have a red X with and exclamation point as the little icon thing next to the name of it.

On the command button, use the code ...

Code:
    DoCmd.OpenQuery "qryQueryName"
-dK
 
I am not sure if I am in the right area to ask this question. In the application I am working on is a Show Program and I need to delete data from 3 tables each year. I can go to Tables, Select All and Delete or I can Create a Delete Query and Run the query and answer yes to the two message boxes to remove the data. I tried to run the Delete Query from both a Command button and from a Macro but both of these procedures do not seem to work allow this to work this way. Is there any way I can remove the data other than the methods mentioned above.

I don't use Macros, so I don't know how to use them. I find them very difficult to understand, very limited in power, and the lack of error handling a big drawback.

I do use VBA code all the time. You can run delete queries with VBA code in a command button.

What code are you using in the Command button?
 
HiTech Coach I use the options that come with the wizards when you choose the command button
dkinley Will try your code.
 
Last edited:
HiTech Coach I use the options that come with the wizards when you choose the command button
dkinley Will try your code.


Even if the wizard buton the code, it still helps to see what code use are using. There still could be a problem with code.

Please post the code that is in the command button.
 
Problem solved used code as per dkinley. That tidies up process nicely. Thanks.
 
Glad we could help. As HiTech mentioned, "it still helps to see what code use are using". Which is the prime reason I only use VBA and not macros - I can't tell what the heck is going on!:p

Getting one thing down is hard enough ... who wants to spend the time learning TWO different ways to do the same thing? ;)

Good luck!
-dK
 

Users who are viewing this thread

Back
Top Bottom