Posted by serge on 10/01/33 11:33
> 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.
For me the dathergestuurd looks to be an empty string.
If you're using MS Access put a breakpoint and see the value of that
variable. Or write a line before:
MSGBOX "dathergestuurd value is " & dathergestuurd
I forgot in Access if it's + sign or & sign to use in the MSGBOX.
You should be able to test various ways your problem.
Try another simple thing replace the variable with the variable you
know has a value:
"AND " & HTdatumMinAantalDagen & " > " & HTdatumMinAantalDagen
I haven't used Access code in a couple of years so I am a little rusty. But
it seems if you're sending this SQL string to SQL Server then you should
enclose the dates inside single quotes:
"AND '" & HTdatumMinAantalDagen & "' > '" & HTdatumMinAantalDagen
& "'"
And if you're not using SQL Server, rather MS Access SQL then the single
quotes should be replaced by # sign.
If you still need help please post what you tried.
Navigation:
[Reply to this message]
|