Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

SQL Error code #13

Hi,

why am I getting a error code 13 when I try to use the following sql command?
Data1.RecordSource = "SELECT * FROM DeptSaleHistory WHERE DeptmentDate='" & "10/05/2006" & " WHERE DeptName=" & "'" & "Open PLU" & "'" "';"
Data1.refresh


Can some one point out my error please as I can not see it

Thanks

Drew
[376 byte] By [Drew_gable] at [2007-11-11 8:41:35]
# 1 Re: SQL Error code #13
... WHERE a=b AND c<d ...

should only have 1 'WHERE'
gupex at 2007-11-11 17:25:06 >
# 2 Re: SQL Error code #13
Data1.RecordSource = "SELECT * FROM DeptSaleHistory WHERE DeptmentDate='" & "10/05/2006" & " DeptName=" & "'" & "Open PLU" & "'" "';"
data1.refresh


This still brings up the error code 13
Drew_gable at 2007-11-11 17:26:17 >
# 3 Re: SQL Error code #13
Data1.RecordSource = "SELECT * FROM DeptSaleHistory WHERE DeptmentDate='" & "10/05/2006" & " AND DeptName=" & "'" & "Open PLU" & "'" "';"
data1.refresh
jggtz at 2007-11-11 17:27:15 >
# 4 Re: SQL Error code #13
Drew,
It looks like you still have the wrong syntax. And aren't dates supposed to be in single quotes?
jedicoder at 2007-11-11 17:28:09 >
# 5 Re: SQL Error code #13
Try this ...

Data1.RecordSource = "SELECT * FROM DeptSaleHistory WHERE DeptmentDate='" & "20061005" & "' AND DeptName='" & "Open PLU" & "'"
gupex at 2007-11-11 17:29:10 >
# 6 Re: SQL Error code #13
Result:
SELECT * FROM DeptSaleHistory WHERE DeptmentDate='" & "10/05/2006" & " WHERE DeptName=" & "'" & "Open PLU" & "'" "';
^-- ^--
syntax error: " & "
correction: ;
syntax error: " & " '" "' ;
correction: ;

http://developer.mimer.com/validator/parser200x/index.tml#parser
jim12345 at 2007-11-11 17:30:21 >
# 7 Re: SQL Error code #13
Thanks guys,

it work fine now

Can anyone help with my other problem I would be most greatfull ( http://forums.dev-archive.com/showthread.php?p=455904#post455904)
Thanks

Drew
Drew_gable at 2007-11-11 17:31:13 >