Solved

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

Posted on 2014-07-23
5
442 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 58

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

Ready to get started with anonymous questions?

It's easy! Check out this step-by-step guide for asking an anonymous question on Experts Exchange.

Question has a verified solution.

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

In earlier versions of Windows (XP and before), you could drag a database to the taskbar, where it would appear as a taskbar icon to open that database.  This article shows how to recreate this functionality in Windows 7 through 10.
Microsoft Access is a place to store data within tables and represent this stored data using multiple database objects such as in form of macros, forms, reports, etc. After a MS Access database is created there is need to improve the performance and…
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 …
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

632 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