timer to save query results to file

M

Miipe

Hi,

I'm trying to run timer every morning to save query results to a file.

How can I run the query so that I can automatically save the query
results and save it with format <query_name>date?

Results will be saved to excel.

Br, Miikka
 
N

NthDegree via AccessMonster.com

Modify the query before you run it,

Private Sub test()
Dim qry As QueryDef
Dim db As Database
Dim strSQL As String

Set db = CurrentDb
Set qry = db.QueryDefs("query1")

strSQL = "SELECT tblLevels.Level, tblLevels.LevelDesc, tblLevels.LeveNotes,
tblLevels.Passed INTO query1" & DatePart("m", Date) & _
DatePart("d", Date) & DatePart("yyyy", Date) & " FROM tblLevels;"
qry.SQL = strSQL


End Sub
 
Top