Macro Error Question

T

TD11

I have a macro that is pretty simple, but when executed gives an error
stating the
"Command or action RUN is not available now". I'm sure I'm missing something
simple as I have written macros before without a problem. Any idea what I'm
running into here?

Thanks for any advice,

Ted
 
R

Rosco

Would you post some more detail on what commands are in your macro, and what
you are trying to do?

We would be better able to help you.

Rosco
 
T

TD11

Sorry, I was just frustrated and didn't give you much to work with.

It's a pretty simple macro.
Echo - Off
SetWarnings - Off
OpenQuery - [Query1 Name]
RunCommand - Run
Close - Query - [Query1 Name]
OpenQuery - [Query2 Name]
RunCommand - Run
Close - Query - [Query2 Name]
SetWarnings - On
Echo - On

Query1 is a delete query and Query2 is an append query. I'm simply trying to
delete and repopulate a table.

Ted
 
R

Rosco

Since your queries are action queries, I don't believe you need the
RunCommand and the CloseQuery commands.

Try this:

Echo - Off
SetWarnings - Off
OpenQuery - [Query1 Name]
OpenQuery - [Query2 Name]
SetWarnings - On
Echo - On

Hope this helps
Rosco


TD11 said:
Sorry, I was just frustrated and didn't give you much to work with.

It's a pretty simple macro.
Echo - Off
SetWarnings - Off
OpenQuery - [Query1 Name]
RunCommand - Run
Close - Query - [Query1 Name]
OpenQuery - [Query2 Name]
RunCommand - Run
Close - Query - [Query2 Name]
SetWarnings - On
Echo - On

Query1 is a delete query and Query2 is an append query. I'm simply trying to
delete and repopulate a table.

Ted



Rosco said:
Would you post some more detail on what commands are in your macro, and what
you are trying to do?

We would be better able to help you.

Rosco
 
T

TD11

Well... that worked and thank you.

I have always built macros using the open-run-close sequence and they have
always worked....until this experience. I appreciate the knowledge. This will
certainly make macros easier/shorter in the future.

Ted

Rosco said:
Since your queries are action queries, I don't believe you need the
RunCommand and the CloseQuery commands.

Try this:

Echo - Off
SetWarnings - Off
OpenQuery - [Query1 Name]
OpenQuery - [Query2 Name]
SetWarnings - On
Echo - On

Hope this helps
Rosco


TD11 said:
Sorry, I was just frustrated and didn't give you much to work with.

It's a pretty simple macro.
Echo - Off
SetWarnings - Off
OpenQuery - [Query1 Name]
RunCommand - Run
Close - Query - [Query1 Name]
OpenQuery - [Query2 Name]
RunCommand - Run
Close - Query - [Query2 Name]
SetWarnings - On
Echo - On

Query1 is a delete query and Query2 is an append query. I'm simply trying to
delete and repopulate a table.

Ted



Rosco said:
Would you post some more detail on what commands are in your macro, and what
you are trying to do?

We would be better able to help you.

Rosco

:

I have a macro that is pretty simple, but when executed gives an error
stating the
"Command or action RUN is not available now". I'm sure I'm missing something
simple as I have written macros before without a problem. Any idea what I'm
running into here?

Thanks for any advice,

Ted
 
R

Rosco

Glad to be of help.

Rosco

TD11 said:
Well... that worked and thank you.

I have always built macros using the open-run-close sequence and they have
always worked....until this experience. I appreciate the knowledge. This will
certainly make macros easier/shorter in the future.

Ted

Rosco said:
Since your queries are action queries, I don't believe you need the
RunCommand and the CloseQuery commands.

Try this:

Echo - Off
SetWarnings - Off
OpenQuery - [Query1 Name]
OpenQuery - [Query2 Name]
SetWarnings - On
Echo - On

Hope this helps
Rosco


TD11 said:
Sorry, I was just frustrated and didn't give you much to work with.

It's a pretty simple macro.
Echo - Off
SetWarnings - Off
OpenQuery - [Query1 Name]
RunCommand - Run
Close - Query - [Query1 Name]
OpenQuery - [Query2 Name]
RunCommand - Run
Close - Query - [Query2 Name]
SetWarnings - On
Echo - On

Query1 is a delete query and Query2 is an append query. I'm simply trying to
delete and repopulate a table.

Ted



:

Would you post some more detail on what commands are in your macro, and what
you are trying to do?

We would be better able to help you.

Rosco

:

I have a macro that is pretty simple, but when executed gives an error
stating the
"Command or action RUN is not available now". I'm sure I'm missing something
simple as I have written macros before without a problem. Any idea what I'm
running into here?

Thanks for any advice,

Ted
 
T

Tom Wickerath

TD11 -

I suggest that you look into learning how to use VBA code, instead of depending on macros. In
the example you gave, if either Query1 Name or Query2 Name ever fails for any reason, your
warnings will remain turned off. There are ways of avoiding this with VBA code, so it's time to
start weaning yourself away from macros.

Tom
___________________________________


Well... that worked and thank you.

I have always built macros using the open-run-close sequence and they have
always worked....until this experience. I appreciate the knowledge. This will
certainly make macros easier/shorter in the future.

Ted

Rosco said:
Since your queries are action queries, I don't believe you need the
RunCommand and the CloseQuery commands.

Try this:

Echo - Off
SetWarnings - Off
OpenQuery - [Query1 Name]
OpenQuery - [Query2 Name]
SetWarnings - On
Echo - On

Hope this helps
Rosco


TD11 said:
Sorry, I was just frustrated and didn't give you much to work with.

It's a pretty simple macro.
Echo - Off
SetWarnings - Off
OpenQuery - [Query1 Name]
RunCommand - Run
Close - Query - [Query1 Name]
OpenQuery - [Query2 Name]
RunCommand - Run
Close - Query - [Query2 Name]
SetWarnings - On
Echo - On

Query1 is a delete query and Query2 is an append query. I'm simply trying to
delete and repopulate a table.

Ted



Rosco said:
Would you post some more detail on what commands are in your macro, and what
you are trying to do?

We would be better able to help you.

Rosco

:

I have a macro that is pretty simple, but when executed gives an error
stating the
"Command or action RUN is not available now". I'm sure I'm missing something
simple as I have written macros before without a problem. Any idea what I'm
running into here?

Thanks for any advice,

Ted
 
Top