|
-
Nov 14th, 2000, 11:20 PM
#1
Thread Starter
New Member
Help!
I was just wodering if anyone knows how to create an SQL string for a database where it would select from a table a range of dates. This code errors out to do with the dates.
Dim db As Database
Set db = OpenDatabase(App.Path & "\adpdumb.mdb")
Set Data1.Recordset = db.OpenRecordset("SELECT date,time,appointment From schedule where date between 'November 3, 2000' and 'November 6, 2000';")
Thanks,
aknighter
-
Nov 15th, 2000, 03:58 AM
#2
Hyperactive Member
You might need to wrap the dates in # instead of ' and also you need to see what format your database expects the date. I am not sure if between works, if it doesn't you could always use > <.
Hope this helps
-
Nov 15th, 2000, 04:19 AM
#3
New Member
Originally posted by aknighter
Help!
I was just wodering if anyone knows how to create an SQL string for a database where it would select from a table a range of dates. This code errors out to do with the dates.
Dim db As Database
Set db = OpenDatabase(App.Path & "\adpdumb.mdb")
Set Data1.Recordset = db.OpenRecordset("SELECT date,time,appointment From schedule where date between 'November 3, 2000' and 'November 6, 2000';")
Set Data1.Recordset = db.OpenRecordset("SELECT date,time,appointment From schedule where
date between #" & Format("November 3, 2000","MM/dd/yyyy")& "# and #" & Format("November 6, 2000","MM/dd/yyyy") & "#"
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
|
Click Here to Expand Forum to Full Width
|