?
Solved

Use batch file to run a macro on OPEN Access database

Posted on 2012-08-17
9
Medium Priority
?
1,397 Views
Last Modified: 2012-10-13
Is there a way to use a batch file or script to run a macro, function or sub on an Access database that is already open? I know I can do this on a closed db as below:

START "" "C:\Program Files\Microsoft Office\Office12\MSACCESS.exe" "H:\Cor-Pro\Woksu\Update\working file\WokSu V 1.5.accdb" /x mcrBatch /cmd 470

Open in new window

For example..

Thanks.
0
Comment
Question by:JP_TechGroup
  • 5
  • 3
9 Comments
 
LVL 77

Expert Comment

by:peter57r
ID: 38305608
Can you put some context on this.  There is no obvious reason why you would not just do what you want from a an open copy of the application.  Why do you need something external to trigger the process.
0
 
LVL 1

Author Comment

by:JP_TechGroup
ID: 38305694
The program sends emails with references to records in the database.
We want to add the ability for users to click on a hyperlink in the body of the email that will open the specified record.
Since Outlook does not support command line switches that use a forward slash, we are getting around it by creating batch files that have the commands needed and hyperlinking to them.
No, It isn't really elegant, but it will work... provided we can call an event, macro, sub or function externally on an already opened database. Make sense?
0
 
LVL 40

Expert Comment

by:als315
ID: 38305992
I think it is not possible directly as you like. You need some data exchange between programs. In Access you can use timer event for collecting some data (external file, clipboard, some table data etc.). From Outlook fill this intermediate object with nesessary data.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 1

Author Comment

by:JP_TechGroup
ID: 38306123
Yea, I didn't really want to run this as a timer event. Too many people accessing this resource from a terminal server concurrently. We'll run out of resources very quickly that way, me thinks.

So am I correct in thinking this can't be done then?
0
 
LVL 40

Expert Comment

by:als315
ID: 38306224
You can do it manually. Set flag in Outlook, then click on form and get result.
0
 
LVL 1

Author Comment

by:JP_TechGroup
ID: 38306425
Sorry, you just took too many shortcuts for a humble developer. Please explain a bit more about what you mean!
0
 
LVL 40

Expert Comment

by:als315
ID: 38307301
I have no experience with Outlook events, but I hope you can do it. I think from Outlook VBA best way - to write records to your DB (if you like bat - use vbscript or powershell). Add table with:
userID (or may be user name), record id (or any other parameter, which can help you to find record), flag (boolean, you should set it to true from Access when record will be opened).
On Access form create button ("Check events", for example), and in code check records in your table with correct userid and flag = false and open these records.
0
 
LVL 1

Accepted Solution

by:
JP_TechGroup earned 0 total points
ID: 38455578
I've been over this again and again and there is no practical way to get this done. Thanks for the suggestions.
0
 
LVL 1

Author Closing Comment

by:JP_TechGroup
ID: 38492572
There is no solution.
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

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

This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
Instead of error trapping or hard-coding for non-updateable fields when using QODBC, let VBA automatically disable them when forms open. This way, users can view but not change the data. Part 1 explained how to use schema tables to do this. Part 2 h…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses
Course of the Month15 days, 10 hours left to enroll

850 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