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 » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

dates are not entered in a consistent format



 
 
Thread Tools Display Modes
  #1  
Old May 27th, 2010, 09:43 PM posted to microsoft.public.access
daisy
external usenet poster
 
Posts: 94
Default dates are not entered in a consistent format

Is it possible to clean up a date field where someone was keeping an excel
sheet and no we are moving this into Access but the date field is a mess

For example he has
1998
2/2005
1/1/2010

We need all dates to be mm/dd/yyyy?

Is there a formula or update I could run against this so he's not going thru
3000 rows of data?

Thank you!
--
Thank you in advance!!!!
  #2  
Old May 27th, 2010, 10:18 PM posted to microsoft.public.access
KARL DEWEY
external usenet poster
 
Posts: 10,767
Default dates are not entered in a consistent format

Bring into Access as a text field by adding phony record just below the
column names and putting text in the column -- XXXX.
Add a text field and a DateTime field to the Access table.
Run update queries like these to update the new text field --
Old_Date: Len([Excel_Date])
Criteria: 4
New_Text:
Update To: "1/1/" & [Excel_Date]

Old_Date: Len([Excel_Date]) New_Date:
Criteria: 8 Is Null
New_Text:
Update To: Left([Excel_Date], InStr([Excel_Date], "/")) & "1" &
Mid([Excel_Date], InStr([Excel_Date], "/"))

Old_Date: [Excel_Date] New_Date:
Criteria: Is Null
New_Text:
Update To: [Excel_Date]

New_Date:
Update To: CVDate([New_Text])


--
Build a little, test a little.


"daisy" wrote:

Is it possible to clean up a date field where someone was keeping an excel
sheet and no we are moving this into Access but the date field is a mess

For example he has
1998
2/2005
1/1/2010

We need all dates to be mm/dd/yyyy?

Is there a formula or update I could run against this so he's not going thru
3000 rows of data?

Thank you!
--
Thank you in advance!!!!

  #3  
Old May 27th, 2010, 10:21 PM posted to microsoft.public.access
Dorian
external usenet poster
 
Posts: 542
Default dates are not entered in a consistent format

How can you possible figure out a day and month for 1998?
-- Dorian
"Give someone a fish and they eat for a day; teach someone to fish and they
eat for a lifetime".


"daisy" wrote:

Is it possible to clean up a date field where someone was keeping an excel
sheet and no we are moving this into Access but the date field is a mess

For example he has
1998
2/2005
1/1/2010

We need all dates to be mm/dd/yyyy?

Is there a formula or update I could run against this so he's not going thru
3000 rows of data?

Thank you!
--
Thank you in advance!!!!

  #4  
Old May 27th, 2010, 11:00 PM posted to microsoft.public.access
KenSheridan via AccessMonster.com
external usenet poster
 
Posts: 1,610
Default dates are not entered in a consistent format

Because a value in the format '2/2005' will be interpreted as the 1st of the
month in question, and the CVDate function will operate quite happily on it,
it can in fact all be done in a single UPDATE query:

UPDATE [YourTable]
SET [New_Date] =
CVDate(IIf(Instr([ExcelDate],"/")0,[ExcelDate],"1/" & [ExcelDate]))
WHERE Len([ExcelDate] & "") 0;

Be sure to force the ExcelDate value to a text data type by means of the
dummy row as described by Karl.

Ken Sheridan
Stafford, England

daisy wrote:
Is it possible to clean up a date field where someone was keeping an excel
sheet and no we are moving this into Access but the date field is a mess

For example he has
1998
2/2005
1/1/2010

We need all dates to be mm/dd/yyyy?

Is there a formula or update I could run against this so he's not going thru
3000 rows of data?

Thank you!


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/201005/1

 




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 12:55 PM.


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