Discussion Locked

Shell command line for Access

0 helpful
7 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

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.

7 replies

by tony hopkinson

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.

by dryflies

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.

by dana803

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.

This discussion is closed to new replies.