Microsoft Access Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMicrosoft Access Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old July 1st, 2005, 02:17 PM
Breed372 Breed372 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Posts: 7 Breed372 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 58 sec
Reputation Power: 0
Thumbs down Should Be Easy!

I have a question which should be an easy one for most of the pros on this site. I need to separate data in one collumn of access into two collumns. The separating I have a collumn with data similar to the following

756398__98076

I need to separate this into two Collumns . . .
756398 98076
The collumn does not contain a consistent amount of characters before or after the "__" separator so i can't use any of the built in functions. I can do this easily in EXCEL using the "text to column" function but don't know how to do this in Access.

Reply With Quote
  #2  
Old July 1st, 2005, 05:06 PM
theguz theguz is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jun 2005
Posts: 54 theguz User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 13 h 40 m 34 sec
Reputation Power: 4
Could you just do it in excel and then import table to Access? That might be the quickest. Or do you need it to be all auto.

Reply With Quote
  #3  
Old July 5th, 2005, 08:59 AM
lwells lwells is offline
Contributing User
Dev Articles Novice (500 - 999 posts)
 
Join Date: Sep 2004
Posts: 632 lwells User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 21 h 59 m 38 sec
Reputation Power: 5
Your formula would be:

This will get the left side of the column

Left(FieldName, InStr(1, FieldName, "_") - 1)

For the right side use the following

Right(FieldName, Len(FieldName) - InStr(1, FieldName, "_"))

lwells

Reply With Quote
  #4  
Old July 5th, 2005, 11:58 AM
Breed372 Breed372 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Posts: 7 Breed372 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 58 sec
Reputation Power: 0
Quote:
Originally Posted by theguz
Could you just do it in excel and then import table to Access? That might be the quickest. Or do you need it to be all auto.


I generally work with datasets containing 100,000 or more rows. To my knowledge Excell can't accept over 65000 or so.

Reply With Quote
  #5  
Old July 5th, 2005, 01:05 PM
Breed372 Breed372 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Posts: 7 Breed372 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 58 sec
Reputation Power: 0
Quote:
Originally Posted by lwells
Your formula would be:

This will get the left side of the column

Left(FieldName, InStr(1, FieldName, "_") - 1)

For the right side use the following

Right(FieldName, Len(FieldName) - InStr(1, FieldName, "_"))

lwells
Thanks a ton. I still have a problem though. The second formula (Right(FieldName, Len(FieldName) - InStr(1, FieldName, "_")) leaves a "_" before all values in the column. I suspect this is due to the fact that there are two underscores in the initial field. Can you offer any suggestions? See Example

Initial Field First Formula Second Formula
014544-300-01__00010450 014544-300-01 _00010450

Reply With Quote
  #6  
Old July 5th, 2005, 01:46 PM
lwells lwells is offline
Contributing User
Dev Articles Novice (500 - 999 posts)
 
Join Date: Sep 2004
Posts: 632 lwells User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 21 h 59 m 38 sec
Reputation Power: 5
Just subtract one of the underscores like below

Right(FieldName, Len(FieldName) - InStr(1, FieldName, "_") -1)

lwells

Reply With Quote
  #7  
Old July 5th, 2005, 02:41 PM
Breed372 Breed372 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2005
Posts: 7 Breed372 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 3 h 58 sec
Reputation Power: 0
Quote:
Originally Posted by lwells
Just subtract one of the underscores like below

Right(FieldName, Len(FieldName) - InStr(1, FieldName, "_") -1)

lwells
I can't thank you enough!

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMicrosoft Access Development > Should Be Easy!


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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 On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT