-
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
-
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
-
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
>
>
-
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
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks