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  

Query to extract data help please



 
 
Thread Tools Display Modes
  #1  
Old February 14th, 2007, 03:24 PM posted to microsoft.public.access.queries
Terry DeJournett
external usenet poster
 
Posts: 12
Default Query to extract data help please

I have one field in a table that contains 5 different values, each seperated
by a ",". (Example: Value1,Val2,V3,Value4,Valu5). Each value may be of
different lenghts (6 characters, 4 characters, etc.) The only common factor
is that each if seperated by a comma (,).

Would anyone know how to run a query to extract the first value and put in
into a new table in field1, then put the next value in field 2, etc. In
orther words to take the entire value of this field and put in into seperate
fields.

Thanks in advance for any suggestions.

T


  #2  
Old February 14th, 2007, 03:57 PM posted to microsoft.public.access.queries
Jerry Whittle
external usenet poster
 
Posts: 4,732
Default Query to extract data help please

Today is your lucky day! Since the data is seperated with commas, Access can
handle it with a little work.

First of all does that table have a primary key? If so great. If not create
an autonumber field in the table and make it the primary key.

Next create a query with the primary key field and the field in question.
However you need to join these two fields together with a comma. Something
like this:

SELECT [CommaPK] & "," & [TheCommasField] AS CSVed
FROM tblCommas;

Run the query and make sure that it looks OK. After running it, export the
query results as a text file. When you get to the Export Text Wizard dialog
box about Text Qualifier select None.

After exporting the query to a text file, import it back in using Get
External Data. This will create a new table which you can join to the
existing table using the primary key field.

The above is something good for a one-time cleanup of data. If this is
something that you have to do frequently, there may be other ways.
--
Jerry Whittle, Microsoft Access MVP
Light. Strong. Cheap. Pick two. Keith Bontrager - Bicycle Builder.

"Terry DeJournett" wrote:

I have one field in a table that contains 5 different values, each seperated
by a ",". (Example: Value1,Val2,V3,Value4,Valu5). Each value may be of
different lenghts (6 characters, 4 characters, etc.) The only common factor
is that each if seperated by a comma (,).

Would anyone know how to run a query to extract the first value and put in
into a new table in field1, then put the next value in field 2, etc. In
orther words to take the entire value of this field and put in into seperate
fields.

Thanks in advance for any suggestions.

T



 




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 06:46 PM.


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