Completely Stumped - Need Help w/macro

L

lj

Jeff C said:
Macro:
SetWarnings Off
Openreport
SetWarnings On
Quit

Runs fine from the program, runs fine when in design mode and clicking run

When placed in command line I get the error and the program freezes.

Help
 
G

Guest

I have been reworking macros for the past 5 days and nothing is working the
way it is supposed to.

Access 2003

The macros I created work fine if the database is open and I just run them.

I am trying to run the macros from the command prompt.

I have created a shortcut,

Start in: c:\Program Files\Microsoft Office\Office11

Target:

"C:\Program Files\Microsoft Office\OFFICE11\MSACCESS.EXE"
"s:\Directory\Analysis.mdb" /x "PrintReport"

No matter what I do, compile the database, compact and repair etc.

in the middle of the macro a window opens "This action will reset the
current code in break mode"

Clicking no the macro processes run but then the database freezes and I have
to end program with task manager.

Any suggestions would be more than welcome, thank you.
 
G

Guest

Hi Jeff.

Try this

"""C:\Program Files\Microsoft Office\OFFICE11\MSACCESS.EXE""
""s:\Directory\Analysis.mdb""/XPrintReport", 1
 
G

Guest

Just had a thought. Why not create a autoexec macro in your DB that will run
OnOpen of the DB. Use the windows shortcut to open the DB and this will
start off the macro. Much simpler.
 
G

Guest

Using your example gave me error that the "C:\...." Path could not be found,
I then received an error stating the the switch being used (,1)? was not
valid in Access.

Thank you though I am still stumped
 
G

Guest

The database is used by many others, I have code that runs on startup
starting customed forms depending on the user, I have programmed the database
to just open without anything running based on my user ID though.
 
G

Guest

"C:\Program Files\Microsoft Office\OFFICE11\MSACCESS.EXE"
"s:\Directory\Analysis.mdb" /x "PrintReport"

This all goes on 1 line. Note the spaces between the " " and no space
between /x (not sure if this makes a difference but best leave it as it is)

I just created a small DB (on our S drive) and tested this from a shortcut
(on my C drive) on the the desktop - works fine for me.
 
G

Guest

Wayne, thank you for your help but I am now back to the same original error.
What could be causing it? How to resolve?
 
G

Guest

Hi

There are a few things you can try

Open the macro in design and click Run (at the top of the screen).

Re-write a simple macro (open a form or something else simple). Set your
shortcut to run this macro - do you have the same problem - it not then just
rewrite the main macro completely.

If there are a number of sections to the macro - set throught it.

Etc.
 
G

Guest

Macro:
SetWarnings Off
Openreport
SetWarnings On
Quit

Runs fine from the program, runs fine when in design mode and clicking run

When placed in command line I get the error and the program freezes.

Help
 

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