Between dates


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: Between dates

  1. #1
    robot Guest

    Between dates

    Hi,
    I'm making a little worksheet management database with Access+ASP
    I want to be able to choose one month and one year and to have all
    worksheets of that month. I've got the function that calculates the days in
    selected month but I don't know how to 'retreive' form database worksheets
    from dataA to dateB only...

    I have work table with: id_work, date, worker, work fields...

    I do this

    SQL="SELECT * FROM [works] "
    SQL= SQL & "WHERE date>26/2/2002"
    SQL= SQL & "and date<15/2/2002"

    And I have no records returned... But I know there are records...

    What am I doing wrong ?

    TIA



  2. #2
    Chris Beelby Guest

    Re: Between dates


    >SQL="SELECT * FROM [works] "
    >SQL= SQL & "WHERE date>26/2/2002"
    >SQL= SQL & "and date<15/2/2002"
    >
    >And I have no records returned... But I know there are records...
    >
    >What am I doing wrong ?
    >
    >TIA


    In access dates must have pound (#) characters around them so it should read:

    SQL = "Select * From works where Date > #26/2/2002# and Date < #15/2/2002#

    -Chris Beelby

  3. #3
    MVSI Guest

    Re: Between dates

    You should use the proper date delimiters as indicated in the previous
    reply, additionally, assuming the included code segment is not a typo, you
    will also need to reverse your < > operators. As it is now, it will always
    be false.

    robot <robot@robot.robot> wrote in message news:3c729b3d$1@10.1.10.29...
    > Hi,
    > I'm making a little worksheet management database with Access+ASP
    > I want to be able to choose one month and one year and to have all
    > worksheets of that month. I've got the function that calculates the days

    in
    > selected month but I don't know how to 'retreive' form database worksheets
    > from dataA to dateB only...
    >
    > I have work table with: id_work, date, worker, work fields...
    >
    > I do this
    >
    > SQL="SELECT * FROM [works] "
    > SQL= SQL & "WHERE date>26/2/2002"
    > SQL= SQL & "and date<15/2/2002"
    >
    > And I have no records returned... But I know there are records...
    >
    > What am I doing wrong ?
    >
    > TIA
    >
    >




  4. #4
    robot Guest

    Re: Between dates

    Thanks, works for me, but using american date type : MM/DD/YYYY... I could
    implement this, but I'm sapnish and I prefer a date like DD/MM/YYYY, less
    'difficult' for debugging...

    Is there some function like trasnform(DD/MM/YYYY)=MM/DD/YYYY

    TIA



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center