Solved

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

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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Most if not all databases provide tools to filter data; even simple mail-merge programs might offer basic filtering capabilities. This is so important that, although Access has many built-in features to help the user in this task, developers often n…
QuickBooks® has a great invoice interface that we were happy with for a while but that changed in 2001 through no fault of Intuit®. Our industry's unit names are dictated by RUS: the Rural Utilities Services division of USDA. Contracts contain un…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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 …

705 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now