General discussion

Locked

Shell command line for Access

By dana803 ·
I use a call tracking program that allows us to customize it somewhat and add code to run here and there, etc. I am trying to run an Access macro (to open a form) using a shell command from within the call tracking program. The form works great when run in Access, so my last hurdle is successfully executing that macro with the shell command. Currently, this is the line I'm using: Shell ("C:\\Program Files\\Microsoft Office XP\\Office10\\MSACCESS.EXE F:\\WINAPPS\\CTEL73\\CTEL.MDB OpenCSCallRpt")
However, I get the error "The command line you entered to start Microsoft Access contains an option that Microsoft Access doesn't recognize. Exit and restart Microsoft Access using valid command-line options." I'm hoping my error is in the syntax. I want it to either open my form or a macro which opens the form. OpenCSCallRpt is the name of the Macro.

This conversation is currently closed to new comments.

7 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Comments

Collapse -

by Tony Hopkinson In reply to Shell command line for Ac ...

Canb't remember exactly but you can get access to automatically run a macro when you open the mdb, should do the job when you find out how though.

Collapse -

by dana803 In reply to

Poster rated this answer.

Collapse -

by dryflies In reply to Shell command line for Ac ...

Your best bet would be to use Windows Scripting Host to do the work instead of the basic shell script. However, another way to get it to run a macro is to build a form that runs the macro when it opens and then set that form to open in the tools>startup... dialog.

Collapse -

by dana803 In reply to

It's actually a form I want to open. I just thought I might have to run a macro (to open the form) if I can only reference a macro. I also don't want to change the startup form in the startup dialog since it's a database that is widely used, and I only want the one form opened when prompted for a particular use in another program.

Collapse -

by dryflies In reply to Shell command line for Ac ...

You need to use the /x command line option,
e.g. msaccess.exe mydb.mdb /x macroName

Collapse -

by dana803 In reply to

Thanks! That did it.

Collapse -

by dana803 In reply to Shell command line for Ac ...

This question was closed by the author

Back to Web Development Forum
7 total posts (Page 1 of 1)  

Related Discussions

Related Forums