Solved

How do I reference the parameter from the MS Access Macro

Posted on 2014-03-21
4
844 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
  • 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 500 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: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

765 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