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  

Delimiting Field Containing - Character



 
 
Thread Tools Display Modes
  #1  
Old February 16th, 2007, 09:22 PM posted to microsoft.public.access.queries
[email protected]
external usenet poster
 
Posts: 2
Default Delimiting Field Containing - Character

I need to turn the following types of number strings into a date
field:

03-1-12345
98-12-12345

Where, the strings would represent:

January 2003
December 1998

In Excel, I could just use the function Text to Columns, and delimit
on the character "-" and then put the string back together.

Unfortunately, I am accessing this table using ODBC, and the values
for this field are constantly updated.

Any help would be most appreciated.

  #2  
Old February 16th, 2007, 10:08 PM posted to microsoft.public.access.queries
John Spencer
external usenet poster
 
Posts: 7,815
Default Delimiting Field Containing - Character

DateSerial(Val("03-1-12345"),Val(Mid("03-1-12345",Instr(1,"03-1-12345","-")+1)),1)
will return January 1, 2003
DateSerial(Val("98-12-12345"),Val(Mid("98-12-12345",Instr(1,"98-12-12345","-")+1)),1)
will return December 1, 1998

So subsititute your field name for the strings above in the formula. Once
you have a real date, you can choose to display it anyway you want.
--
John Spencer
Access MVP 2002-2005, 2007
Center for Health Program Development and Management
University of Maryland Baltimore County
..

wrote in message
oups.com...
I need to turn the following types of number strings into a date
field:

03-1-12345
98-12-12345

Where, the strings would represent:

January 2003
December 1998

In Excel, I could just use the function Text to Columns, and delimit
on the character "-" and then put the string back together.

Unfortunately, I am accessing this table using ODBC, and the values
for this field are constantly updated.

Any help would be most appreciated.



 




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 09:51 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.