Command text syntax and comma

D

Dave

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")
 
M

Markus Stolle

I saw the response to this not too long ago, as I am currently as wel
experimenting with the Querytables.add

now I am not sure for the exact reason, something to do with the lengt
of strings, but the Commandtext string has been chopped in to smalle
sections and assembled in an array.


Code
-------------------

.CommandText = Array( _
"This is a very very lon" _
,"g string and thats wh" _
,"y it was cut in so man" _
,"y differnt array segme" _
,"nts so that it will work")
 

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

Top