Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old July 10th, 2003, 07:05 AM
Registered User
 
Join Date: Jun 2003
Location: , , Netherlands.
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to MRvLuijpen Send a message via MSN to MRvLuijpen
Default Conversion part of string to date

Hello Experts,

I have a date inside a string. I would like to extract the date from this string. I made a query which extracts part of the string.

Code:
SELECT Mid[IDCode],3,11) AS date, Unit, systemvalue, Type
FROM qryUnit
If I want to apply an filter with
 
Code:
 WHERE date BETWEEN #1/1/2000# AND #1/1/2003#


the query result is empty. I think that the problem lies in the filter date vs string.

How can I change this??

Your help is appriciated very much

Marc
Reply With Quote
  #2 (permalink)  
Old July 10th, 2003, 07:14 AM
Friend of Wrox
Points: 4,007, Level: 26
Points: 4,007, Level: 26 Points: 4,007, Level: 26 Points: 4,007, Level: 26
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Lansing, Michigan, USA.
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

Quote:
quote:Originally posted by MRvLuijpen
Code:
SELECT Mid[IDCode],3,11) AS date, Unit, systemvalue, Type
FROM qryUnit
How about this?

Code:
SELECT CDate(Mid([IDCode],3,11)) AS date, Unit, systemvalue, Type FROM qryUnit

Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
Reply With Quote
  #3 (permalink)  
Old July 10th, 2003, 07:34 AM
Registered User
 
Join Date: Jun 2003
Location: , , Netherlands.
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to MRvLuijpen Send a message via MSN to MRvLuijpen
Default

Greg,

Thx... It works good

Marc
Reply With Quote
  #4 (permalink)  
Old May 18th, 2004, 10:59 AM
Registered User
 
Join Date: May 2004
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to kshantik
Default

My date is a string in the format of MMDDYY eg: 012904

I want to write a query to pull all the records with date greater than '01/29/04'

I have oracle background and there were nice functions like TO_DATE(columnname,'MM/DD/YY') to use in my query and I am wondering if there is anything like this in MS Access. If not, how do I solve this?

Thanks
Shanti
Reply With Quote
  #5 (permalink)  
Old May 18th, 2004, 02:30 PM
Friend of Wrox
Points: 4,007, Level: 26
Points: 4,007, Level: 26 Points: 4,007, Level: 26 Points: 4,007, Level: 26
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Lansing, Michigan, USA.
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

In your query, simply put this in the criteria row for your specific date field

  >=#1/29/04#


Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
Reply With Quote
  #6 (permalink)  
Old May 18th, 2004, 02:31 PM
Friend of Wrox
Points: 4,007, Level: 26
Points: 4,007, Level: 26 Points: 4,007, Level: 26 Points: 4,007, Level: 26
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Lansing, Michigan, USA.
Posts: 1,151
Thanks: 2
Thanked 14 Times in 14 Posts
Send a message via ICQ to SerranoG Send a message via AIM to SerranoG
Default

Oh, wait... your date is a string... you have to convert the string into a real date. See the post on that topic in this forum section.

Greg Serrano
Michigan Dept. of Environmental Quality, Air Quality Division
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Conversion from string to type 'Date' error jellyjune BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 9 August 12th, 2007 02:05 AM
Conversion from string "" to type 'Date' jellyjune .NET Framework 1.x 1 August 11th, 2007 04:12 AM
Getting Part of a String needelp Access VBA 4 September 19th, 2006 06:22 AM
Convert Part of String to Date twsinc Access VBA 6 October 20th, 2004 03:31 PM
Conversion from string to date kshantik Access 2 May 19th, 2004 12:17 PM



All times are GMT -4. The time now is 05:38 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.