Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 10th, 2003, 07:05 AM
Registered User
 
Join Date: Jun 2003
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
 
Old July 10th, 2003, 07:14 AM
Friend of Wrox
 
Join Date: Jun 2003
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
 
Old July 10th, 2003, 07:34 AM
Registered User
 
Join Date: Jun 2003
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
 
Old May 18th, 2004, 10:59 AM
Registered User
 
Join Date: May 2004
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
 
Old May 18th, 2004, 02:30 PM
Friend of Wrox
 
Join Date: Jun 2003
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
 
Old May 18th, 2004, 02:31 PM
Friend of Wrox
 
Join Date: Jun 2003
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





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





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.