Do I use Macro or Code

N

Nick

I want to delete data with the criteria of using "Year" and "Quarter" but
before that happens. I would like a message box to appear asking "Do you want
to print data before deletion. with a "Yes" or "No" buttons. If "Yes" display
the criteria for query , open and print "QuarterReport" then delete said
data. If "No" display message "Data will be deleted" with another message
box "Complete Deletion" and "No print report before deletion" then do command
of the buttons that are pushed.
 
E

Ed Metcalfe

Nick said:
I want to delete data with the criteria of using "Year" and "Quarter" but
before that happens. I would like a message box to appear asking "Do you
want
to print data before deletion. with a "Yes" or "No" buttons. If "Yes"
display
the criteria for query , open and print "QuarterReport" then delete said
data. If "No" display message "Data will be deleted" with another message
box "Complete Deletion" and "No print report before deletion" then do
command
of the buttons that are pushed.

Nick,

I don't believe it's possible to trap user responses from messageboxes in
macros - they are all single button "OK" messages. You'll need to do it in
VBA.

The only time I use macros is to specify a startup macro (not autoexec, but
one that is called from the shortcut to open the database) and an AutoKeys
macro. Other than that it is best (in my opinion at least) to avoid macros.

Ed Metcalfe.
 
S

Steve Schapel

Nick,

In the Condition of your macro, use a MsgBox function. If you can't see
the Condition column in the macro design window, select it from the View
menu.

So your macro would look something like this...

Condition: MsgBox("Print data?",547)=6
Action: OpenReport (QuarterReport)
Condition: ...
Action: OpenQuery (your delete query)
Condition: ...
Action: StopMacro
Condition: <blank>
Action: MsgBox (Data will be deleted)
 

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

Top