?
Solved

How do I reference the parameter from the MS Access Macro

Posted on 2014-03-21
4
Medium Priority
?
949 Views
Last Modified: 2014-04-13
I would like to start access from command line, running a macro when the mdb starts, and pass a parameter to that macro, straight from the command line. Something like this:

"C:\Program Files\Microsoft Office\Office11\msaccess.exe" "c:\test.mdb" /x Macro_access_start "123"

The macro "Macro_access_start" would start a form that was based on query the parameter "well" to filter the data

Is this possible? How do I reference the parameter from the Macro?

Thanks!

Dallag
0
Comment
Question by:Mohammed Dallag
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 40

Expert Comment

by:als315
ID: 39947076
Look at sample. Command line should be:
"C:\Program Files\Microsoft Office\Office11\msaccess.exe" "c:\test.mdb" /x Macro_access_start /cmd "123"

Open in new window

test.mdb
0
 

Author Comment

by:Mohammed Dallag
ID: 39947360
I tried the attached access file with the command but it is not working.

"C:\Program Files (x86)\Microsoft Office\Office14\MSACCESS.EXE" "D:\test123.mdb" /x WBI  /cmd ”123”
test123.mdb
0
 
LVL 40

Accepted Solution

by:
als315 earned 2000 total points
ID: 39947410
If you a trying to open form with some criteria, you can use Where line.
Try this sample. EP_A_NUM is decimal, so you should remove quotes around parameter:
"C:\Program Files (x86)\Microsoft Office\Office14\MSACCESS.EXE" "D:\test123.mdb" /x WBI  /cmd 123
test123.mdb
0
 

Author Closing Comment

by:Mohammed Dallag
ID: 39997166
very good
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

As tax season makes its return, so does the increase in cyber crime and tax refund phishing that comes with it
It’s the first day of March, the weather is starting to warm up and the excitement of the upcoming St. Patrick’s Day holiday can be felt throughout the world.
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question