Converting text to dates

Hi

I have inherited an Access 97 database which has the dates 
in text format eg '20040425'.  Changing the data type in 
design view deletes all the records.  Anyone know how I 
can convert these dates from text to date without data 
loss.

Thanks

GLS
0
GLS
4/26/2004 8:08:17 AM
access.conversion 3037 articles. 0 followers. Follow

2 Replies
666 Views

Similar Articles

[PageSpeed] 48

You can add a new field (of Date type) to your table and then do an Update
query to fill it with the date value from your text field.   Here is the SQL
for an Update query using the DateValue() function to convert the text to a
true date:

UPDATE [MyTable] SET [MyTable].NewDateField = DateValue(Left([TextField],4)
& "/" & Mid([TextField],5,2) & "/" & Right([TextField],2))


hth,
--

Cheryl Fischer, MVP Microsoft Access
Law/Sys Associates, Houston, TX


"GLS" <gavinsalton@hotmail.com> wrote in message
news:42c301c42b65$a17d9630$a101280a@phx.gbl...
> Hi
>
> I have inherited an Access 97 database which has the dates
> in text format eg '20040425'.  Changing the data type in
> design view deletes all the records.  Anyone know how I
> can convert these dates from text to date without data
> loss.
>
> Thanks
>
> GLS


0
Cheryl
4/26/2004 12:34:34 PM
Thanks Cheryl - that worked great.

Much appreciated

GLS
>-----Original Message-----
>You can add a new field (of Date type) to your table and 
then do an Update
>query to fill it with the date value from your text 
field.   Here is the SQL
>for an Update query using the DateValue() function to 
convert the text to a
>true date:
>
>UPDATE [MyTable] SET [MyTable].NewDateField = DateValue
(Left([TextField],4)
>& "/" & Mid([TextField],5,2) & "/" & Right([TextField],2))
>
>
>hth,
>--
>
>Cheryl Fischer, MVP Microsoft Access
>Law/Sys Associates, Houston, TX
>
>
>"GLS" <gavinsalton@hotmail.com> wrote in message
>news:42c301c42b65$a17d9630$a101280a@phx.gbl...
>> Hi
>>
>> I have inherited an Access 97 database which has the 
dates
>> in text format eg '20040425'.  Changing the data type in
>> design view deletes all the records.  Anyone know how I
>> can convert these dates from text to date without data
>> loss.
>>
>> Thanks
>>
>> GLS
>
>
>.
>
0
GLS
4/26/2004 2:55:40 PM
Reply:

Similar Artilces:

Converting a Microsoft Word document to a PC document
Version: 2008 Operating System: Mac OS X 10.5 (Leopard) Processor: Intel I have created a Resume and a cover letter in Microsoft Word on a Mac to be uploaded to the Institute ORACLE recruitment system. <br><br>When I checked how it looked, the format, the bullets and formating were blown apart! I was told to convert the documents to PC format. <br><br>I don't know how to do this. I got some guidance to make them PDF files, but the formating still goes haywire! How do I do the conversion on my Mac? Hi Meg: The most important thing to do is DO NOT TEL...

Money Changes Transaction Dates
Hi all, How can I stop Money2004 from changing my transaction dates that I have already entered into the register? This happens when I accept/match downloaded transactions from my bank. Thanks! Well, I think I just answered my own question. I found a check box to untick under online options to fix this, but I will post back if necessary. "rustyfender04" <rustyfender1@hotmail.com> wrote in message news:eY3zaLITHHA.2124@TK2MSFTNGP06.phx.gbl... > Hi all, > > How can I stop Money2004 from changing my transaction dates that I have > already entered into t...

adding months to an inputted date
I need a function that will take a date that a user has typed in a different cell and will then add two months to the date. For instance, if I type "2/12/05" in B1, then I want C2 to be: "4/12/05". Thank you for any help that you may be able to give. Logan =DATE(YEAR(B1),MONTH(B1)+2,DAY(B1)) however what do you want the date to be in C2 if B1 is 01/30/05? Regards, Peo Sjoblom "BLW" wrote: > I need a function that will take a date that a user has typed in a different > cell and will then add two months to the date. For instance, if I type >...

Lookup text
Hi! I have two ranges I wanna match. The content of the ranges are numbers. If match, I wanna pick up the TEXT (AorB)from the column to right of one of the ranges. I regularly use SUMIF function, which works fine if the content I wanna pick up is numbers. Does anyone know how to solve this problem? Here is the sumif example: {=SUM(IF(Deliveries! $H$9:$H$158=$E6;IF(Deliveries!$D$9:$D$158=$G6;Deliveries! $J$9:$J$158;0);0))} Help is appreciated. Gunnar Hi Gunnar This array formula: =INDEX(Deliveries!$J$9:$J$158,MATCH(1,(Deliveries!$H$9:$H$158=$E6)* (Deliveries!$D$9:$D$158=$G6),0)) Ente...

Convert date to months
I have a database that has multiple dates in it. What I am trying to do is in one field I have a date and I am want that date to convert to months in another field. Can anyone help me on this. -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/access-queries/200707/1 are you trying to find months between dates? or convert 4 to April? Look at format function for ways to display months, datediff function for months difference.. "bohon79 via AccessMonster.com" <u35329@uwe> wrote in message news:74ac2f3f40ce9@uwe... >I have a database ...

Exchange rich-text format
What are the results from the client side if I change my Exchange 2003 server to "Alwayes Use" Exchange Rich-Text format from "Determined by individual user settings"? On Thu, 22 Jun 2006 08:31:01 -0700, CK <CK@discussions.microsoft.com> wrote: >What are the results from the client side if I change my Exchange 2003 server >to "Alwayes Use" Exchange Rich-Text format from "Determined by individual >user settings"? Depends on what your users are sending messages as. Most will be using HTML or RTF anyway unless you have some policy in p...

If statement with formatted text
Hi, Is there any way to have an if formula such as: If (A1="Active", "KAE",KPE") where the two letters after the K are formatted as subscript? The best I've done is to paste a picture over the cell. The picture's formula refers to named formula that selects one of two cells, the one with correct string. One cell contains KAE and the other KPE with the subscript. However, it means that I'm using a picture and it would be much nicer if I could just do it in an If formula. I hope that makes some kind of sense, and thanks in advance for your help. D...

Importing Text File #3
Did ya ever have one of those lucky accidents that you like and would like to replicate? I created a simple excel workbook based on imported text data. Later, when I reopended the file, I noticed that the "refresh" button was activated and would auto import when I clicked. The best part is that the import specs were retained. I have no idea how I did this and have not been able to replicate the functionality. Can someone help? Thanks Bean, It sounds as if you used Data - Get external data. It remembers all the paramaters you specify, and you have only to do a refresh, ...

Display Part Text In Report
I hv this sample report in my field 01-01-08ABCDE.................... I want to display ABCDE........and so on...and not the 01-01-08 What should i do... Thanks zyus, Try this in the Control Source of a text box on your report: =Mid([YourFieldName],9) Caution: The text box name must be different than the field name. If they are the same, change the text box name to txtYourFieldName. Good luck. -- Sco M.L. "Sco" Scofield, MCSD, MCP, MSS, A+, Access MVP 2001 - 2005 Denver Area Access Users Group Past President 2006/2007 www.DAAUG.org MS Colorado Events Administrator www....

How to remove the alternative text box from the publisher email?
Hi, I have created a publisher email and have email it to myself for testing view. I find there is a small alternative text box appearing whenever my mouse cursor station at any point of the email. How to remove this alternative text box from the publisher email? Help... -- Thank you, Cpviv Sounds like all the text has was converted to an image. Try to select the text and you will see it is an image. Go to tools > Options > Web tab and under Email options uncheck the option to send as an image. If that doesn't fix the problem, reference: Tips and troubleshooting for ...

Change from MS Outlook Rich Text to HTML
I use Outlook 98 and I want to change my message format to HTML so that I can have nice backgrounds etc on my mail. For some reason this facility doesn't seem to be available to me on the 'Mail Format' Tab. It is blacked out and I cannot change it from Rich Text to HTML. Is there anything I can do to sort this out? Could it be because I am on a network at work and they have disabled it? If so, how can I enable it? Cheers! ------------------------------------------------ ~~ Message posted from http://www.ExcelTip.com/ ~~View and post usenet messages directly from http://www...

Need to convert point on screen to various screen resolutions
Let's say you click on a button on your screen at 1000,2500 TWIPS and your resolution is 800 X 600. Now you change your screen resolution to 1024 X 768 and you need to click on the same button in it's new location on the screen. Who's 100 times smarter than I am and can do some tricky math that will tell me the TWIPS to find that button? I'd ned to do the same calculation for other screen resolutions like 640 X 480 etc. http://www.applecore99.com/api/api012.asp -- Regards, Tom Ogilvy "Donna YaWanna" <diy@mdahospital.com> wrote in message news:%23HMLEWW2...

Using cell text in a formula
I am trying to use derived cell references in a VLOOKUP formula to matc data in several tables. For example, A1 contains the cell reference fo the top left of my array (A3) whilst cell A2 contains the cel reference for the bottom right of my array (D14). The array I' checking against starts in column E3. However, when I use the formula =VLOOKUP(E3,A1:A2,4,FALSE) I get a #N/ error. I need to use the cell references in each VLOOKUP as the arra sizes may vary in each case. (PS, I've used =INDIRECT(ADDRESS(A1,A2) to derive the cell references. Ji -- Message posted from http://www.Excel...

Trouble with hyhens within text when using LOOKUP
I have two columns, each containing a list of part numbers. Some of the part numbers contain hyphens. I am using LOOKUP and/or VLOOKUP to determine if the value in one column exists in the other. This works great on non-hyphenated part numbers. However, it will not find or return the hyphenated part numbers from the specified arrays. As a test, I did a quick if statement to compare the instances of identical hyphenated values that exist in both columns. Those statements did not have a problem with the hyphens. Can anyone offer any help? If hyphens cannot be used in conjunction with the ...

Saving html message as Draft changes text formatting...
WIN XP HE, OL 2002 Hi, I have recently noticed that whenever I write an email (using Word as editor) in html format, and instead of sending it, save it (to the drafts folder), the text itself changes format from my default to another one. It seems to change in the paragraph style which then changes the text format. The only change I recently made was to edit my signatures in html, rtf and plain text format. When I write a new email, it opens up with the signature already in it and perhaps there are format/style conflicts..? Tx for shedding some light into this. S As an added information, t...

How do I convert a list to an Excel file?
I have a WORD file with 48 lines of comma delimited data in the form: xxx,xxxxxxx,xxxxxx,x,x,xxx,xxxxxxxxx xx,xxx,xxx,xxx,xxx,xx,x I would like to convert the WORD list to EXCEL. When I attempt to open the WORD file in EXCEL, I thought a conversion window would appear....what I actually get is "incorrect format" Hi! Save the WORD file as a plain text file. Then, when you open the file in Excel a Wizard will open and step you through it. Just select COMMA as the delimiter. Biff >-----Original Message----- >I have a WORD file with 48 lines of comma delimited data in ...

Calendar/Dates Help
Hi All, I have an excel spreadsheet that lists every date in the year, with a particular code in the next cell. IE: Monday 3/01/2005 11M 22M 32M Tuesday 4/01/2005 11T 22T 32T Wednes 5/01/2005 11W 22W 32W Thursday 6/01/2005 11H 22H 32H Friday 7/01/2005 11F 22F 32F Saturday 8/01/2005 11S 22S 32S Sunday 9/01/2005 11N 22N 32N Monday 10/01/2005 11M 21M 33M Tuesday 11/01/2005 11T 21T 33T Wednes 12/01/2005 11W 21W 33W Thursday 13/01/2005 11H 21H 33H Friday 14/01/2005 11F 21F 33F What I need is to be able to search by the code eg "33T" and have all the dates listed for ...

Date comparison better method
Select col1, col2 from TableName where DateColumn BETWEEN '2010-06-01' and '2010-06-17 23:59:59.997' Select col1, col2 from TableName where WHERE DateColumn >= '2010-06-01' AND DateColumn < '2010-06-17 23:59:59.997' I am seeing in a project both the above methods of data range filering is happening in different SPs. I am trying to understand which is the better method of comparing two date values and why? [Btw i know BETWEEN considers both the upper and lower limit] Regards Pradeep I would say the following is the better approach: ...

Extracting Time from a cell that has both the date and the time
Hi Folks, I could do with some help here please. I am trying to extract the time only from a cell that has both the date and the time. Can anyone suggest a solution? Thanks in advance. :confused: -- Hani Muhtadi ------------------------------------------------------------------------ Hani Muhtadi's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=26794 View this thread: http://www.excelforum.com/showthread.php?threadid=466177 If you just wish the time to display, set the cell format to Time. If you wish to use the time portion then =A1-Int(A1) will give you...

Text box jumps to left of page
Word 2004 (I am relatively new to Word and am delighted to find a forum specifically for the Mac version. There are a number of unresolved, niggling issues I can live however they slow the workflow. I am eager to learn.) In the recent past, I manually converted 12,000+ recipes from WordPerfect 7 to Word. Since Word 2004 does not have a filter for the old files, the conversion was done on the Windows side of my Mac in Word2003. Those files _usually_ open without protest also in 2004. One annoyance regards text boxes. When text was highlighted and a text box was requested for it in...

How did you add text into publisher, without using boxes?
how do you add text to publisher without using text boxes I suppose you could create your text as an image and insert the image into your publisher file. -- Don Vancouver, USA "Calvin Scott" <Calvin Scott@discussions.microsoft.com> wrote in message news:64D23D52-138D-47B4-B265-4A41BF14BF55@microsoft.com... > how do you add text to publisher without using text boxes Calvin Scott <Calvin Scott@discussions.microsoft.com> was very recently heard to utter: > how do you add text to publisher without using text boxes You don't. Text in Publisher has to e...

instructions disppear when users begin type (text field)
Hi all, I need to customize the outlook contact form and I want to add one text field to allow users to add details info and instruct users how to add. Instructions shows in the field and the instructions disappear when users click and begin to type. How should I do this? exchange 2003/outlook2003 Thank you. It's hard for me to visualize exactly what you're expecting to happen. If you want the instructions to stay on the screen, you could display them in a label control. -- Sue Mosher, Outlook MVP Author of Microsoft Outlook 2007 Programming: Jumps...

Get Start date of Week number and Year
I’d like to build the following expression in my query GetStartWeekNumber(DatePart("ww",[EnteredDate]), Year([EnteredDate])) So if EnteredDate = 11/3/2009 the function would return 11/1/2009 But GetStartWeekNumber does not exist as an Access Built-In Function. Is there another way to do this as an expression in a query? I’m not familiar with creating my own functions. Thanks. That would depend on how you define the start of the week... One option would be to get the day-of-week number of the date (in my system/setup, Monday is day 2), then subtract one less than that...

cannot view all of text in large cell, even though I have it to w.
I have cell format to wrap text and it works fine to a p[oint then no more text is displayed....casn increase the size of the cell, but still only so much will display....rest of the cell show blank. Hi +the limit is 1024 characters. You can extend this with manually inserting linebrekas using aLT+ENTER -- Regards Frank Kabel Frankfurt, Germany sydme wrote: > I have cell format to wrap text and it works fine to a p[oint then no > more text is displayed....casn increase the size of the cell, but > still only so much will display....rest of the cell show blank. ...

can lookup return cell reference istead of "text" for sumif?
I am trying to use a lookup-function to determine a different sum range for several criteria. Like so: =Sumif($A$7:$A$1447;"<"&X3;vlookup(e3;AT3:AU11;2;false)-Sumif($A$7:$A $1447;"<"&y3;vlookup(e3;AT3:AU11;2;false) The problem is that the vlookup returns text and not the cell reference. Is there a way to get the answer from the lookup expressed as cell reference instead of text, since sumif can't use text, just the cell reference? I use it to calculate the number of hours the staff should be paid, so it's different from weekdays to saturdays, holidays...