Solved

How do I reference the parameter from the MS Access Macro

Posted on 2014-03-21
4
782 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:dallagmm
  • 2
  • 2
4 Comments
 
LVL 39

Expert Comment

by:als315
Comment Utility
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:dallagmm
Comment Utility
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 39

Accepted Solution

by:
als315 earned 500 total points
Comment Utility
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:dallagmm
Comment Utility
very good
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

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 a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
With Microsoft Access, learn how to specify relationships between tables and set various options on the relationship. Add the tables: Create the relationship: Decide if you’re going to set referential integrity: Decide if you want cascade upda…

771 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now