A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

convert month text (MAR) to month number (3)



 
 
Thread Tools Display Modes
  #1  
Old December 10th, 2009, 07:59 PM posted to microsoft.public.access.queries
HLCruz via AccessMonster.com
external usenet poster
 
Posts: 35
Default convert month text (MAR) to month number (3)

I am trying to work with a data set that unfortunately has spit out all the
dates in a text format - i.e. 03/01/2009 is MAR 3 2009.

Is there a way to convert that text date to an actual date format?

Any advice or suggestions are greatly appreciated.

Thanks

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...eries/200912/1

  #2  
Old December 10th, 2009, 09:00 PM posted to microsoft.public.access.queries
Jerry Whittle
external usenet poster
 
Posts: 4,732
Default convert month text (MAR) to month number (3)

Debug.Print CDate("MAR 3 2009") = 3/3/2009

One problem with the CDate function is that it will bomb out on things that
can't be evaluated as a date. Therefore you may want to use the IsDate
function first. Something like this will work in a query. If it can't be
evaluated as a date, it returns a bogus 1/1/1950 date. You could change this
to a more bogus date if that would help find them. Remember to change the
YourDateField to the actual name of your field.

TheDate: IIf(IsDate([YourDateField])=True,Cdate([YourDateField]),#1/1/1950#)
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.


"HLCruz via AccessMonster.com" wrote:

I am trying to work with a data set that unfortunately has spit out all the
dates in a text format - i.e. 03/01/2009 is MAR 3 2009.

Is there a way to convert that text date to an actual date format?

Any advice or suggestions are greatly appreciated.

Thanks

 




Thread Tools
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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 08:20 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.