473,791 Members | 3,211 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

VBS Script to Run Macro in Access 2003

I want to nightly run a VBS Script in Scheduled tasks to open an
Access 2003 database and execute a macro.

The problem is that the database opens to a switchboard screen. I
need to open this database with a VBS script that mimicks opening the
database with {shift} open. My code:
dim accessApp
set accessApp = CreateObject("A ccess.Applicati on")
accessApp.visib le = True
accessApp.OpenC urrentDataBase( "C:\ACF\Cop ied from Server\ACF.mdb" )
accessApp.Run "Macro1"
accessApp.Quit
When this script executes, the switchboard is open, and the Macro1
can't be found (executed).
Thanks
Jun 27 '08 #1
3 5329
JvC
Set up a seperate application with the objects you need to run your macro.
Attach the tables you need in ACF.mdb
Give your new mdb an autoexec macro, with the following commands:
RunMacro with Macro 1 as the Macro name.
Quit

Set up the new mdb to run in Scheduled Tasks

John

"White Horse" <mi***********@ msn.comwrote in message
news:47******** *************** ***********@79g 2000hsk.googleg roups.com...
>I want to nightly run a VBS Script in Scheduled tasks to open an
Access 2003 database and execute a macro.

The problem is that the database opens to a switchboard screen. I
need to open this database with a VBS script that mimicks opening the
database with {shift} open. My code:
dim accessApp
set accessApp = CreateObject("A ccess.Applicati on")
accessApp.visib le = True
accessApp.OpenC urrentDataBase( "C:\ACF\Cop ied from Server\ACF.mdb" )
accessApp.Run "Macro1"
accessApp.Quit
When this script executes, the switchboard is open, and the Macro1
can't be found (executed).
Thanks


Jun 27 '08 #2
As the other poster suggested, simply setup another mdb file with linked
tables to the application, and then you good to go. Place you code in a
standard module, and then your run command will execute that code (your
script looks just fine).
--
Albert D. Kallal (Access MVP)
Edmonton, Alberta Canada
pl************* ****@msn.com
Jun 27 '08 #3
Thanks for the input.

I believe this would be a good solution, but unfortunately, I can't
change the original ACF.mdb database (admin permissions that have
nothing to do with Access databases). I am permitted to "go through
the backdoor" by pressing the shift key before clicking open. I tried
Sendkeys "+", but this did not work.

I do a great amount of VBA from Excel dealing with Access databases,
but I couldn't do anything from there, either.

Mike
Jun 27 '08 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
2314
by: Tony Williams | last post by:
I have two tables 1.tblmonth which holds two fields txtmonth and txtqtrlabel and 2. tblmain which holds a number of fields but in particular a field called txtqtrlabel2. The two tables are linked on txtqtrlabel and txtqtrlabel2. I have a main form based on tblmonth which has a subform based on tblmain, the two forms are also linked on the same fields. The data entered into txtmonth could be "30/09/04" and the txtqtrlabel data would be...
1
2745
by: paul.hanti | last post by:
This board has been a plethora of information. Thanks to all that respond! I have a quick question regarding the built-in OutputTo macro. I've built a shared database in Access 2003 (in Access 2000 file format) that resides on a shared network drive. This OutputTo macro is essentially setup to export one small table to an Excel spreadsheet once a user clicks a command button on the switchboard. Another user and I (both of us have...
6
9864
by: geronimo_me | last post by:
Hi, I am trying to run an Excel macro from an Access module, however when I run the code the macro runs but then I get an error in Access. The error is: Run-time error "440", Automation error. My code is: Sub Run_Excel_Macro() Dim xls, xlWB As Object
7
4967
by: Jim Cook | last post by:
We have a macro which takes various index constants as an argument and offsets into an array. The macro can be an Lvalue or Rvalue. The index is not zero based. I would like a compile time error displayed if the index is out of bounds. Is there a way to do this well? I read through the FAQ that I could find mentioned, and did not see this sort of question in the preprocessor section anywhere. What I came up with is below. It does in...
2
2846
by: Ntl News Group | last post by:
I understand that when using Access 2003, the security settings prevent the VBA code from running correctly and need to be set to the Low setting. My question is: Can this be done automatically using VBA, in other words, when my DB opens can it check to see if running Access 2003 and if so then change the macro security settings to low? Regards
0
1061
by: fordraiders | last post by:
vb.net 2003 Access 2003 I need to run a macro from vb.net in an access database. But the podule needs parameters passed to it.. oAccess.Run(<macro>) But I need to pass 2 Variable strings? TableName and Ouput file destination "CatalogMsc" "C:\DM\Catalog_DataMsc.xls" Thanks
8
2462
by: Briansmi1116 | last post by:
Hi all, I am using Access 2003 as well as Excel 2003. I have an Access database that has an output to Excel button I created. This outputs a form to an Excel file A. I then have Excel file B formatted and linked to A. I would like to do this without the link, where when I export to Excel, it automatically formats the Fields. If I run the macro in Excel to format on open, every time I export the file it deletes the macro. So this...
1
1859
by: bytes access nubie | last post by:
Hello. I'm trying to create one macro in Access 2003 that will delete a field (called ID) in a table. I then need a separate macro that will *add* a field back in called ID w/type of autonumber. I was trying to use the Action of RunCommand, DeleteTableColumn for the first macro but I'm not having luck... Any help you can provide will be very appreciated.
1
2107
by: Pittsford | last post by:
I used Sendkeys extensively in Access 97 to enter repetitive text into fields directly in a table. I am now using Access 2000 and none of the SendKeys macros work. I allowed Access to "convert" the mdb file and I tried re-creating the AutoExec macro from scratch. No luck. I emailed the Access 97 mdb file to a friend who has Access 2003. He allowed Access 2003 to convert the file and the SendKeys macros work perfectly. Does anyone know why...
0
9666
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
9512
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10419
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
10201
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
10147
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
9023
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6770
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
4100
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2910
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.