Solved

Is it possible to schedule a query for export in access?

Posted on 2014-07-23
5
415 Views
Last Modified: 2014-07-24
I have a query that is linked to live data that I run every morning and export to excel.  Is it possible to have this done automatically on a scheduler of some kind?
0
Comment
Question by:garyrobbins
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
5 Comments
 
LVL 22

Expert Comment

by:Kelvin Sparks
ID: 40215326
The only way I know to do this is to use Windows Scheduler to start Access (probably a copy of your current db) which will have your report built into a macro. The startup string would be used to call the Macro (Google Access startup strings) which would then run the report, export it and close the database.


Kelvin
0
 

Author Comment

by:garyrobbins
ID: 40215373
How do i get a Macro to run on Access Startup
0
 
LVL 31

Expert Comment

by:Helen_Feddema
ID: 40215426
Years ago, I did this with a VBScript macro:

Set appAccess= CreateObject("Access.Application")
strDBNameAndPath = "E:\Documents\Access 2002-2003 Databases\General.mdb"
appAccess.Visible = True
appAccess.OpenCurrentDatabase strDBNameAndPath
appAccess.DoCmd.RunMacro "mcrPrintOrdersReport"
appAccess.CloseCurrentDatabase
Set appAccess = Nothing

Open in new window


Save it with the .vbs extension, and try running it from the Windows Scheduler.  The last time I tried it was probably in Windows ME and Office XP or thereabouts, so I don't know whether it would work now.
0
 
LVL 31

Assisted Solution

by:Helen_Feddema
Helen_Feddema earned 250 total points
ID: 40215432
You can run a macro from the startup of an Access database (not Access in general) by putting a RunMacro action into an AutoExec macro.
0
 
LVL 57

Accepted Solution

by:
Jim Dettman (Microsoft MVP/ EE MVE) earned 250 total points
ID: 40215658
<<The startup string would be used to call the Macro (Google Access startup strings) which would then run the report, export it and close the database.>>

  Google Access startup strings?  you've got to be kidding.

There are three ways to fire off:

1. Helen hit the first, call the code from a macro called autoexec.

2. Use the /x command line switch to call a specific macro at start-up (which Kelvin sort of hit)

3. Use the /cmd switch to pass parameters to the DB, view those parameters in code, and react accordingly based on the value.

all those are covered here:

http://www.experts-exchange.com/VP_73.html

at 23:50 in.

Jim.
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

710 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