SQL Select statment
-
Hello everybody! Can some one please tell me what am i doing wrong here? Set SearchRS = MSLog.Execute("SELECT OrderNumber, OptOut, DateIn FROM OptOutLog WHERE DateIn between 4/1/2003 AND 4/30/2003") This does not return any records and i know that there are records with dates in that range I have tried <= => nothing works Thank you very much!!! ilya P.
-
Hello everybody! Can some one please tell me what am i doing wrong here? Set SearchRS = MSLog.Execute("SELECT OrderNumber, OptOut, DateIn FROM OptOutLog WHERE DateIn between 4/1/2003 AND 4/30/2003") This does not return any records and i know that there are records with dates in that range I have tried <= => nothing works Thank you very much!!! ilya P.
i think you need ticks around the dates Set SearchRS = MSLog.Execute("SELECT OrderNumber, OptOut, DateIn FROM OptOutLog WHERE DateIn between '4/1/2003' AND '4/30/2003'") and if you are using access you might need the pound signs (#) Set SearchRS = MSLog.Execute("SELECT OrderNumber, OptOut, DateIn FROM OptOutLog WHERE DateIn between #4/1/2003# AND #4/30/2003#") also, you might want to add the time, like.... '04/01/2003 00:00:00' AND '04/30/2003 23:59:59' Steve
-
i think you need ticks around the dates Set SearchRS = MSLog.Execute("SELECT OrderNumber, OptOut, DateIn FROM OptOutLog WHERE DateIn between '4/1/2003' AND '4/30/2003'") and if you are using access you might need the pound signs (#) Set SearchRS = MSLog.Execute("SELECT OrderNumber, OptOut, DateIn FROM OptOutLog WHERE DateIn between #4/1/2003# AND #4/30/2003#") also, you might want to add the time, like.... '04/01/2003 00:00:00' AND '04/30/2003 23:59:59' Steve
-
Dear Steve Thank you very much!!! I tried with ' around before, but i completely forgot about # signs. It works like magic now. Thank you Ilya P. :)
iluha wrote: Thank you very much!!! I tried with ' around before, but i completely forgot about # signs. Access uses the # sign where SQL Server uses a single quote. -Nick Parker