-
SQL and date range selection
I am trying to select a date between the start date and the end date as the
code below states
SQL = "SELECT * FROM Contact WHERE [Next Appointment Date] > #" & txtStartDate.Text
& _
"# <= #" & txtEndDate.Text & "#;"
However I do not get the results I expect. I am using access 2k and vb6.
What am I doing wrong
thanks
cal
-
Re: SQL and date range selection
"cal" <sticks2@earthlink.net> wrote:
>
>I am trying to select a date between the start date and the end date as
the
>code below states
>
>SQL = "SELECT * FROM Contact WHERE [Next Appointment Date] > #" & txtStartDate.Text
>& _
> "# <= #" & txtEndDate.Text & "#;"
>
>However I do not get the results I expect. I am using access 2k and vb6.
>What am I doing wrong
>
>
>thanks
>cal
-
Re: SQL and date range selection
Try this:
SQL = "SELECT * FROM Contact WHERE [Next Appointment Date] > #" & txtStartDate.Text
& "# AND [NEXT Appointment Date] <= #" & txtEndDate.Text & "#;"
Chris
"cal" <sticks2@earthlink.net> wrote:
>
>I am trying to select a date between the start date and the end date as
the
>code below states
>
>SQL = "SELECT * FROM Contact WHERE [Next Appointment Date] > #" & txtStartDate.Text
>& _
> "# <= #" & txtEndDate.Text & "#;"
>
>However I do not get the results I expect. I am using access 2k and vb6.
>What am I doing wrong
>
>
>thanks
>cal
-
This is what im using for a vb6 project im working on now, using the datetimepicker , The t1 and t2 is the name givin to datetimepicker.
Hope this might help.
'rs.Open ("SELECT DISTINCT Equipment,`Date`,Employee,Fuel,Gallons,Price,Total,Record from tblFuel2 group by Equipment,`Date`,Employee,Fuel,Gallons,Price,Total,Record having date between #" & t1 & "# and #" & t2 & "#"), conn, adOpenKeyset, adLockOptimistic
-
I don't answer coding questions via PM or Email. Please post a thread in the appropriate forum section.
Please use [Code]your code goes in here[/Code] tags when posting code.
Before posting your question, did you look here?
Got a question on Linux? Visit our Linux sister site.
Modifications Required For VB6 Apps To Work On Vista
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