View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 6,953
Default Date format in Excel query

"WHERE (DebJournal.Dato={'" & format(StartDate,"yyyy-mm-dd") & "'})" &
Chr(13) & "" & Chr


--
Regards,
Tom Ogilvy

"Peter Hesselager" wrote:

Hi Group.
I created this query with Excel Macro, and it works.
Then I put a date in a cell in Excel, and assigned the value to Variable
StartDate, and it works.
Now I want to put the StartDate into the WHERE instead of 2005-01-04, but
that does NOT work.
Any Ideas ?

"SELECT DebJournal.Konto, DebJournal.Dato, DebJournal.Varebeløb" & Chr(13) &
"" & _
Chr(10) & "FROM DebJournal DebJournal" & Chr(13) & "" & Chr(10) &
"WHERE (DebJournal.Dato={d '2005-01-04'})" & Chr(13) & "" & Chr(10) & "ORDER
BY DebJournal.Konto, DebJournal.Dato" _
)
.Refresh BackgroundQuery:=False

--
Med venlig hilsen
Peter Hesselager-Olesen
SBS-IT Aps