|
Posted by Erland Sommarskog on 11/10/20 11:33
T. Wintershoven (wintershoven@quicknet.nl) writes:
> Can someone please tell me whats wrong with the last line of the query
> below. The first three lines work fine but when i add the fourth line i
> get an error message (see text at ERROR MESSAGE)
>
> sql_HTTermijnRecords = "select * from Orders where FaktuurGeprint
> = 'J'" & _
> "AND dathergestuurd Is Not Null " & _
> "AND PerBankKas Is Null " & _
> "AND " & HTdatumMinAantalDagen & " > " & dathergestuurd
>
> The last line is a comparison between two dates.
>
> ERROR MESSAGE
>============================================
> Run-time error 3075
>
> Syntax error (missing operator) in query expression 'FaktuurGeprint =
> 'J' AND dathergestuurd Is Not Null AND PerBankKas Is Null AND
> 22-11-2005 >'
>
>========= end error message==============================
>
> The first date (22-11-2005) is visible in the error message but the second
> date is missing.
> As you can see there is nothing after the > but there should be date
> information from a DB-cell named dathergestuurd.
Juding from the error message, this is not SQL Server so being outside
my realm, I will have to guess. But I note that the first instance of
dathergestuurd is within a string literal, and the second is not. Whatever
the second refers to, it is not a database column.
I also suspect that you need to put the date within some delimiters. If
you are using Access, that's #.
And the next time you have a question to ask, please be a little more
considerate when you choose a newsgroup. Particularly, there is no point
to post to a newsgroup about SQL Server, if you are not using SQL Server.
--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx
[Back to original message]
|