Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am having a frustrating time finding why simply adding a "AND" clause
within my WHERE clause would cause a problem. I am getting an SQL syntax error. In the code below, textDate and textTodaysDate are both dates in string format "yyyy-mm-dd hh:mm:ss" The following works: sSql = "SELECT 'Confirmations' AS [dCategory], `DONE confirmations`.`Sender Name` AS `dFrom`, `DONE confirmations`.Received AS [dReceived], 1 AS [dAllOnes] " sSql = sSql & Chr(13) & "" & Chr(10) & "FROM `" & textDBQ & "`.`DONE confirmations` `DONE confirmations` " sSql = sSql & Chr(13) & "" & Chr(10) & "WHERE(`DONE confirmations`.Received{ts '" & textDate & "'}) " The following gives an "SQL Syntax error". The errror occurs when I refresh the query using ths sql statement in the CommendText sSql = "SELECT 'Confirmations' AS [dCategory], `DONE confirmations`.`Sender Name` AS `dFrom`, `DONE confirmations`.Received AS [dReceived], 1 AS [dAllOnes] " sSql = sSql & Chr(13) & "" & Chr(10) & "FROM `" & textDBQ & "`.`DONE confirmations` `DONE confirmations` " sSql = sSql & Chr(13) & "" & Chr(10) & "WHERE(`DONE confirmations`.Received{ts '" & textDate & "'} And `DONE confirmations`.Received<{ts '" & textTodaysDate & "'}) " Regards, Android. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
correct syntax for nesting "if", "and", and "vlookup"....if possib | Excel Worksheet Functions | |||
Converting "uppercase" string data to "lower case" in CSV file | Excel Discussion (Misc queries) | |||
nested if contains a syntax error because of a "." | Excel Discussion (Misc queries) | |||
Problem with SQL "Like" clause in Excel | Charts and Charting in Excel | |||
"string too long" error message | Excel Discussion (Misc queries) |