473,414 Members | 1,691 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

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("Access.Application")
accessApp.visible = True
accessApp.OpenCurrentDataBase("C:\ACF\Copied 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 5309
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**********************************@79g2000h sk.googlegroups.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("Access.Application")
accessApp.visible = True
accessApp.OpenCurrentDataBase("C:\ACF\Copied 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
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...
1
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...
6
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. ...
7
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...
2
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...
0
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?...
8
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...
1
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...
1
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...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...
0
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,...
0
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...
0
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...
0
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...
0
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...

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.