473,625 Members | 3,111 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Run a batch file to exec a macro without having to re-open a new instance of access

1 New Member
I am trying to execute a macro in my access database from a windows scheduler task but instead of the batch script re-opening access I need it to run on an already open database. The reason for this is we are having a problem with our linked tables whereby everything we re-open the database we are requiring to re-authenticate our linked tables via a polyp menu.
Jun 15 '13 #1
1 4370
TheSmileyCoder
2,322 Recognized Expert Moderator Top Contributor
If you use a wscript file you can use code like:
Expand|Select|Wrap|Line Numbers
  1. strPath="C:\Databases\YourAccessDatabase.accdb"
  2. Set AccessApp=GetObject(strPath).Application
  3. AccessApp.Run "NameOfProcedure"
  4. set oApp=Nothing
If the app is already open, it will use the active application, and if not, it will open a new instance of access.
Jun 17 '13 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

14
3545
by: Mark C. | last post by:
I'm trying to call a batch file that I've built using the FileSystemObject and CreateObject("Wscript.Shell"), oShell.Run... in an asp script. Naturally, I can get the script to work from a command line but not from a browser. The page does not throw an error but the oShell.Run... portion of the script doesn't run. Any help would be appreciated. Thanks.
3
5060
by: Keith Wilby | last post by:
I have some code in my app that updates data by interrogating data from Artemis. It works fine, but I wondered if I'd be able to write a batch file which, at a predetermined time each day, would open the app 'silently' and run the code. I'm no whizz at batch files/DOS commands, but I've written them to open an Access app - it's the rest of it that I need advice about. How would I get the app to recognise that it was opened by the batch...
4
47489
by: Bill | last post by:
I need help closing a CMD window when it is executed from Access. 1) The batch file is called from Access. 2) Access closes, 3) the batch runs a copy of the access database (creating a backup) 4) Once the copy is complete, the batch file opens the Access database again 5) EXIT should close out the cmd window but it does not execute that line
4
26810
by: CliffKing | last post by:
I am trying to use Windows Task Scheduler to run a batch file for an already open MS Access database. Below is the syntax to the batch file: Batch file: DailySalesExport.bat REM This runs the macro that exports the reports to the J drive PATH = "C:\Program Files\Microsoft Office\Office\;C:\Windows\Command" START /WAIT Msaccess.exe "D:\acesdata\SALES\Daily2005.mdb" /x "SnapShotExportDailySales" EXIT
13
5423
by: MLH | last post by:
I have a batch file named GetConf.bat. It contains a line like this: ipconfig /all >c:\MyAppDir\IPdata.txt I believe I could run the line with something like ShellWait by Terry Kreft. Any reason I should run the procedure via a batch file call as opposed to launching the command string directly?
1
1613
by: Dieter Vanderelst | last post by:
Dear all, Could anybody tell me whether there are ways to use an existing DLL file in Python without having access to the source code? I'm trying to find a way to use the image filters available in the Filters-project (http://filters.sourceforge.net/) without having to compile or build the DLL myself, which is according to the authors very hard.
7
21591
by: rhjaisingh | last post by:
Folks, I need to create a batch file that will do the following - Establish a DB2 instance Connect to a certain database Get data using an sql and output it to a file So, this is what I have done in my test.cmd file
1
8697
by: A_StClaire_ | last post by:
hi everyone, is this possible? I know there are third party tools such as Aspose.Cells for .NET, but do you know of any cost-free alternatives? should mention using OLEDB is not a preferred option. thx a mil
14
12790
by: =?Utf-8?B?R2lkaQ==?= | last post by:
Hi, In my windows applicationm, i need to excute a batch file. this batch file throws some text and questions to the screen, i need to catch the standard Output, check if it's a question, in case it's a question, i want to popup a messageBox or something, and bring back to the batch file the result (Yes\No question). I know how to excute the batch file and get all the Standard output at the end, but i don't know who can i read it line by...
1
6198
by: 9916404403 | last post by:
How to display PDF file in browser without having any save option using Asp.net my mail id is email removed for security
0
8253
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8692
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8635
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8354
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8497
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6116
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5570
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
1802
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1499
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.