Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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") |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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") ------------------- so if you just move the ", " part a little bit back in your code, i should be easier to insert your formula -- Message posted from http://www.ExcelForum.com |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
using a conditional suffix in text function format syntax=text(value,format_text) | Excel Worksheet Functions | |||
Extract the text between last comma and last but one comma. | Excel Worksheet Functions | |||
Pivot Table Error Message - "Command Text not set for command obje | Excel Discussion (Misc queries) | |||
syntax for "IF" commend to check for multiple empty cells bf comma | Excel Worksheet Functions | |||
Correct syntax for use Replace command via DDE? | Excel Programming |