473,794 Members | 2,729 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Split Column, Combine Two rows

Help please

i have a file which im importing, however it is a single column, the
data looks like

C8517673505
N7062175
C8517673516
N7062178
C8517673527
N7062174
C8517673538
N7062187
C8517673549
N7062188

i want to basically put these records into another table with two
columns, to look like this

C8517673505 N7062175
C8517673516 N7062178
C8517673527 N7062174
C8517673538 N7062187
C8517673549 N7062188

Any suggestions on how to accomplish this?.

thanks
Nov 12 '05 #1
3 11521
Create two queries. In the first query, set the criteria as "C" & "*" and in the
second query set the criteria as "N" & "*". Export each query into a different
Excel worksheet. Copy and paste the "N" numbers in the column beside the "C"
numbers. Go back to Access, open the database windows to Tables, click on File -
Get External Data and follow the instructions to import the two columns into a
new Access table.
--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdata sheet.com
www.pcdatasheet.com
"Stephen Matthews" <sm*******@burb idge.co.uk> wrote in message
news:d5******** *************** ***@posting.goo gle.com...
Help please

i have a file which im importing, however it is a single column, the
data looks like

C8517673505
N7062175
C8517673516
N7062178
C8517673527
N7062174
C8517673538
N7062187
C8517673549
N7062188

i want to basically put these records into another table with two
columns, to look like this

C8517673505 N7062175
C8517673516 N7062178
C8517673527 N7062174
C8517673538 N7062187
C8517673549 N7062188

Any suggestions on how to accomplish this?.

thanks

Nov 12 '05 #2
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Another way would be to write a VBA routine that would read each 2
line pair and put the results into the production table.

== air code ==

const SQL_IN = "SELECT * FROM ImportTable"

dim db as dao.database
dim rsIn as dao.recordset
dim rsOut as dao.recordset
dim strCol1 as string, strCol2 as string

set db = currentdb
set rsIn = db.OpenRecordse t(SQL_IN)
set rsOut = db.OpenRecordse t("FinalTable ")

do while not rsIn.EOF

' Get the data in 2-line pairs from the
' imported file.
strCol1 = rsIn(0)
rsIn.MoveNext
strCol2 = rsIn(0)

' Put the 2-line pair into 1 record
rsOut.AddNew
rsOut!Column1 = strCol1
rsOut!Column2 = strCol2
rsOut.Update

rsIn.MoveNext

loop

== end air code ==

You'd have to change the table and column names to your usage. You'd
also have to add error handling routines - watch out for EOF when not
expected (read the 1st line of a 2-line pair and trying to read the
2nd line, but it's not there).

HTH,

MGFoster:::mgf
Oakland, CA (USA)
-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBP7Wf54echKq OuFEgEQKwqQCgry 2coautzmBtovYTg 9Wxp8o7MhYAn1hk
6J4xERdXfdYvdfi lDrFC42Z5
=osEX
-----END PGP SIGNATURE-----
PC Datasheet wrote:
Create two queries. In the first query, set the criteria as "C" & "*" and in the
second query set the criteria as "N" & "*". Export each query into a different
Excel worksheet. Copy and paste the "N" numbers in the column beside the "C"
numbers. Go back to Access, open the database windows to Tables, click on File -
Get External Data and follow the instructions to import the two columns into a
new Access table.
--
PC Datasheet
Your Resource For Help With Access, Excel And Word Applications
re******@pcdata sheet.com
www.pcdatasheet.com
"Stephen Matthews" <sm*******@burb idge.co.uk> wrote in message
news:d5******** *************** ***@posting.goo gle.com...
Help please

i have a file which im importing, however it is a single column, the
data looks like

C8517673505
N7062175
C8517673516
N7062178
C8517673527
N7062174
C8517673538
N7062187
C8517673549
N7062188

i want to basically put these records into another table with two
columns, to look like this

C8517673505 N7062175
C8517673516 N7062178
C8517673527 N7062174
C8517673538 N7062187
C8517673549 N7062188

Any suggestions on how to accomplish this?.

thanks


Nov 12 '05 #3
"Stephen Matthews" wrote
i have a file which im importing,
however it is a single column, the
data looks like

C8517673505
N7062175
C8517673516
N7062178 ... i want to basically put these records into
another table with two columns, to look
like this

C8517673505 N7062175
C8517673516 N7062178


Are you, in fact, importing a _text file_ or are you importing a _table_?
The answer will, of course, differ for each of these.

It's a little confusing to me because you say you are importing a "file" but
then that you want to put the data into "another table".

Larry Linson
Microsoft Access MVP
Nov 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
3734
by: Steve Jorgensen | last post by:
Hi all, I'm working on the schema for a database that must represent data about stock & bond funds over time. My connundrum is that, for any of several dimension fields, including the fund name itself, the dimension may be represented in different ways over time, and may split or combine from one period to the next. When querying from the database for an arbitrary time period, I need the data to be rolled up to the smallest extent...
5
38315
by: Antanas | last post by:
Is it possible to combine multiple rows returned from select statement into one row? SELECT NAME FROM TABLE1; I want all names to be combined into one row seperated by commas.
1
1783
by: rcamarda | last post by:
I have a column that has text delimited by a percent sign that I wish to turn into rows. Example: A column contains ROBERT%CAMARDA, I want to turn that into two rows, one row with ROBERT and antoher row with CAMARDA. I will have source rows that have zero, one, or many percent sign delimiters that will correspond to that many rows (One percent sign will create 2 rows, 2 percent signs will create 3 rows and so forth). Any thoughts?
8
6923
by: cycleops | last post by:
Can anyone please help? I'm trying to combine 2 or more similar rows into one row, accumulating a field for quantity. E.g.: index, field1, field2, quantity 1, ccc, bbb, 5 2, aaa, bbb, 15 3, aaa, bbb, 3 Because the contents of fields 1 & 2 are the same in rows 2 and 3, I want to end up with only one row with the total quantity. index, field1, field2, quantity
1
14939
by: Oonz | last post by:
Hi Friends, How to transpose the columns into rows i want to convert the table which looks like this ID Name HomePhone WorkPhone Email 1 test1 678364 643733 test1@test.com 2 test2 678344 643553 test2@test.com
7
1662
by: carlos139 | last post by:
I have a access table that contains multiple reccords per client. I want to combine each record based on the client into one row with separate field names. Table below: JobNbr, LineNbr, Desc, Product, Brand 1, 1, BAR, Mark5, Barcode 1, 2, SPR, Mark2, Sprint 1, 3, SPI,Mark4,Roll 2,1,BAR,Mark1, Barcode 2,2,SPR,Mark3,Valet
2
5723
denny1824
by: denny1824 | last post by:
Hi everyone, Here is my problem. I have a Table Variable (I could easily turn it into a Temp Table instead) that will sometimes have rows that are identical except for one specific column. The column is of nvarchar. When the rest of the columns for those rows are identical, I want to combine all of the values of that column into a single nvarchar with a delimiter in between each value. Then combine the rows where all of the other columns are...
1
2490
by: bcr123 | last post by:
Hello. Could you please help with following problem in Microsoft Excel: I have thousands or rows of 5min data that I need to convert to 15min and later to 20min data do some calculations. Data looks as following (4 rows out of thousands): A B C D E F G 3/17/2008 9:55:00 1995 1995 1995 1995 2
4
5296
by: IT Couple | last post by:
Hi I'm pretty new to SSIS and I wonder if you could help me. I download HTML files (thounsands) as text files using SSIS and then using foreach loop I load each file into table text data type field. Works great apart from that some files appear on multiple rows I presume SSIS thinks there is a new record but there isn't as I want to load the whole file into the table text data type field. So I have two questions: 1) How to import text...
0
9671
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9518
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10433
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9035
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7538
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5436
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5560
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4112
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2919
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.