View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
dave dave is offline
external usenet poster
 
Posts: 37
Default Command text syntax and comma

I recorded the following macro for to import data from SQL.

At line 5 why is there ", " in the syntax i.e. {ts '2004-02-18 00:00:", "00'} ?
I want to reduce this to {ts '2004-02-18 00:00:00'} but I get type mismatch

What is the ", " there for and why cant I get rid of it. I want to replace the hard coded date with a variable.

Dave

.CommandText = Array( _
"SELECT qry_ASX_52Weeks.WeekEnding, qry_ASX_52Weeks.ASXCode, qry_ASX_52Weeks.AveWeeklyClose" & Chr(13) & "" & Chr(10) & _
"FROM qry_ASX_52Weeks qry_ASX_52Weeks" & Chr(13) & "" & Chr(10) & _
"WHERE (qry_ASX_52Weeks.WeekEnding<={ts '2004-02-18 00:00:", "00'} And qry_ASX_52Weeks.WeekEnding={ts '" _
& Start & _
"'}) AND (qry_ASX_52Weeks.ASXCode='" & compname & "')" & Chr(13) & "" & Chr(10) & _
"ORDER BY qry_ASX_52Weeks.WeekEnding")