Solved

How do I reference the parameter from the MS Access Macro

Posted on 2014-03-21
4
861 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 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: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

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

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
AutoNumbers should increment automatically, without duplicates.  But sometimes something goes wrong, and the next AutoNumber value is a duplicate.  This article shows how to recover from this problem.
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

732 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