Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. SQL Select statment

SQL Select statment

Scheduled Pinned Locked Moved Visual Basic
databasequestion
4 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • I Offline
    I Offline
    iluha
    wrote on last edited by
    #1

    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.

    S 1 Reply Last reply
    0
    • I iluha

      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.

      S Offline
      S Offline
      ScaleOvenStove
      wrote on last edited by
      #2

      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 1 Reply Last reply
      0
      • S ScaleOvenStove

        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 Offline
        I Offline
        iluha
        wrote on last edited by
        #3

        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. :)

        N 1 Reply Last reply
        0
        • I iluha

          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. :)

          N Offline
          N Offline
          Nick Parker
          wrote on last edited by
          #4

          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

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups