timer to save query results to file

  • Thread starter Thread starter Miipe
  • Start date Start date
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
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top