Problems with action queries in a macro group

S

SteveS

I have a situation where I want to select records in a given table and append
them to another table. I then want to run two update queries that will
adjust the quantity field of the records in both the original and the
appended table. I have written the action queries, and when manually run in
sequence, these work fine. I want them all to run sequentially upon a
OnClick event, so I combined all three into a macro group that is associated
with a command button on a form (linked to the original table). I have
created this macro group that consists of three OpenQuery actions that open
the append query, and then the two update queries in turn.

Unfortunately, the three action queries will not run in this macro. Only
the first action query will run. This is true if I run the entire group or
try to single step through them. I will get the append query acting properly
(I have not turned off the warnings, so I see each of the warning dialog
boxes), and then nothing else. There are no error messages, the macro just
quits as if the other actions were not there. In an effort to debug, I
placed MsgBoxes between the three action queries. The Append query would run
and the first message box would display. After clicking OK on that box,
nothing more happens.

I also tried placing each action query in a separate macro and making my
macro group contain three RunMacro actions and pointing each of them to the
action queries. Same result.

Can anyone give me some help on this? I have looked through a lot of web
sites (Microsoft and otherwise), but have not found any explanation for this
result.
 
S

Steve Schapel

Steve,

Have you entered anything in the Name column of the macro group? Have
you got blank lines in the macro design between the actions?
 
S

SteveS

Following is what the current version of the macro group looks like.
MacroName Action Parameters
AppendCurr OpenQuery (AppendRemovedItemquery, datasheet, edit)
MsgBox (Test box, yes, none, blank)
UpdateCurrInv OpenQuery (UpdateCurrItemquery, datasheet, edit)
MsgBox (Test Box 2, yes, none, blank)
UpdateRemoved OpenQuery (UpdateRemovedItemquery, datasheet, edit)

There are no blank lines between any of the above items. With the above 5
actions, I get the append query and the first message box working. After
that, nothing.

I also tested the group by deleting the first two actions of the above. In
that case, the first update query and the remaining message box work, but the
last update query does not execute.

This is a strange situation that I have no idea how to resolve. Hope you
can help.

Steve
 
S

SteveS

That did the trick. Thanks. I guess from this that when macro actions in a
group are named, that they are then treated as a single action rather than a
sequence of actions.

Since I had spent a lot of time looking through the on-line documentation, I
went back to see where I had missed this information. I guess it is there,
but not very clearly understood. For example, in the page entitled "Create a
macro or macro group" that is found in the Access help, the instructions for
create a macro group, step 6 says to repeat steps 4 and 5 for any other
macros that you want included in the macro group. Step 4 says to type a name
in the Macro Name column. In notes that follow these steps, it is stated
that the macro will run until another macro group name is encountered.
However, this is still not clear. I interpreted what I was doing as naming
steps in a single macro group, not adding another group.

Hope this suggestion helps someone else in the future.
 
S

Steve Schapel

Steve,

A macro group is a group of macros :) This is not applicable to the
task you are trying to perform. You can only run one macro at a time.
Creating a macro group which includes a number of individually named
macros, is a great way to manage macros where you only want to run one
of the macros within the group at any given time. In this case, in the
event property where you are assigning the macro, you specify the name
of the macro within the macro group. What you are doing is not a job
for a macro group. You want a single macro with a number of actions in
that macro, i.e. all the actions you want to perform at any given time
within the same macro. Hope that helps to clarify.
 

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