Reply to Re: Help needed with query syntax

Your name:

Reply:


Posted by Gert-Jan Strik on 09/30/58 11:33

Tino,

22-11-2005 is not a date. At most, it is an expression (a calculation)
that resolves to -1994. If you want it to be a date, then use quotes to
make it a string that can be converted to a date. It is also best to use
a safe date format, for example YYYYMMDD. This will correctly convert to
a datetime regardless of server or language settings. So for example
'20051122'.

Also note, that the line
"AND " & HTdatumMinAantalDagen & " > " & dathergestuurd
will cause all selected rows to be returned or none. This means that you
could simply write:

If HTdatumMinAantalDagen > dathergestuurd Then
' your original query without the last line
sql_HTTermijnRecords = ...
Else
' no rows to return
End If

HTH,
Gert-Jan


"T. Wintershoven" wrote:
>
> Hi
>
> 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.
> I tried a lot of things but i keep getting the same message.
>
> What is wrong with the syntax of the last line ???
>
> T.i.a.
>
> Regards
>
> Tino Wintershoven
> The Netherlands

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация