Smart questions
Smart answers
Smart people
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Member Login

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips now!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

Join Tek-Tips
*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

LINK TO THIS FORUM!

Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

Partner With Us!

"Best Of Breed" Forums Add Stickiness To Your Site
Partner Button
(Download This Button Today!)

Feedback

"...Keep up the very good job that you and your team are doing. This site has replaced my morning cup of tea as a must have/do!!!..."

Geography

Where in the world do Tek-Tips members come from?
EuanPirie (Programmer)
11 May 99 11:43
I'm trying to write a query in an existing Access 97 database where I want to search on a date. The date has to be in a 1 week window about 6 months ago (it's for a report for printing which tests are required that week). The date is stored in a text field of size 20(I had nothing to do with it!).

Any ideas?
KurtMiller (Programmer)
12 May 99 19:52
1) look at the datediff function

2) text dates can be evaluated in sql:

where some_date_field >= #01/01/99#

using the # sign as a delimiter

i don't have any documentation handy or i would be more specific but that's the general idea
Hallsys (Programmer)
13 May 99 12:12
There are so many ways to do this it's hard to pick one. Since you're dealing with character data you can do whatever you'd like depending on how the dates have been entered.

1. Create a new field in the table and populate it using an update query that employs the CDate() function which takes any valid character Date Expression ("12/25/99"). Then write the WHERE clause how you would normally on the new field.

2. Use this directly on the data:
WHERE CDate([Your20CharDateField]) between #12/21/99# and #12/28/99#

3. Use the Left(), Right() and Mid() functions directly on the character data to parse out the Month and Day and make logical comparisons to your desired window to return the proper records.

4. If theres more to it than it appears due to the way the dates are entered in the 20 char field, write a function in VB in a module within the database and call it from the SQL:
WHERE myDateConv-CompFunction([Your20CharDateField]). In the function perform all of the acrobatics needed to determine if the character data being sent to the function is within your window.

Hope this helps.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close