Solved

Multiple Cell Contents To Individual Rows/Records

Posted on 2013-01-17
6
379 Views
Last Modified: 2013-01-17
Dear Experts

I have multiple contents in 1 Cell/Field which i would like to put them in individual rows, the items are delimited by the ampersand. I've illustrated my problem in a visio...PDF.

Thank you much Experts!
0
Comment
Question by:Dare626
  • 2
  • 2
  • 2
6 Comments
 

Author Comment

by:Dare626
ID: 38790100
Here is the attachment.
Visio-Cells-Items-To-Rows-Proble.pdf
0
 
LVL 119

Assisted Solution

by:Rey Obrero
Rey Obrero earned 350 total points
ID: 38790127
you will need vba codes to do that

dim rs1 as dao.recordset, rs2 as dao.recordset, vArr() as string, j

set rs1=currentdb.openrecordset("table1")
set rs2=currentdb.openrecordset("table2")

do until rs1.eof
     varr=split(rs1![Measure],"&")
     for j =0 to ubound(vArr)
         rs2.addnew
         rs2!Mem_NO=rs1!Mem_NO
         rs2![Measure]=varr(j)
         rs2.update
     next

rs1.movenext
loop
0
 
LVL 2

Accepted Solution

by:
MMTadmin earned 50 total points
ID: 38790162
Assuming you are savvy with talking to databases?

Public Function SplitMyValues

Dim rs as Recordset
Dim Measures() as String
Dim k as Long

'get the rs of Table1 here

With rs
Do until .eof
Measures = Split(!Measure, " & ")
For k = 0 to ubound(Measures)
sql = insert into Table2(Mem_No, Measure) VALUES (!Mem_No, Measures(k))
cn.execute sql
Next
.movenext
Loop
End with
0
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 2

Expert Comment

by:MMTadmin
ID: 38790171
capricorn1 >> split character =  " & " unless you want to trim varr(j)
0
 
LVL 119

Expert Comment

by:Rey Obrero
ID: 38790181
oh yeah , didn't notice the space, thanks


dim rs1 as dao.recordset, rs2 as dao.recordset, vArr() as string, j

set rs1=currentdb.openrecordset("table1")
set rs2=currentdb.openrecordset("table2")

do until rs1.eof
     varr=split(rs1![Measure],"&")
     for j =0 to ubound(vArr)
         rs2.addnew
         rs2!Mem_NO=rs1!Mem_NO
         rs2![Measure]=trim(varr(j))
         rs2.update
     next

rs1.movenext
loop
0
 

Author Closing Comment

by:Dare626
ID: 38790182
Thank you Capricorn for the fast post and MMTAdmin for expanding on capricorns solution with. I appreciate both of your time answering my question...worked perfect!
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Access 2016 - Query Challenge 15 51
Help with SQl and UNION 3 19
Conditional formatting based on date 2 12
Stored Procedure 2 0
Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
Introduction The Visual Basic for Applications (VBA) language is at the heart of every application that you write. It is your key to taking Access beyond the world of wizards into a world where anything is possible. This article introduces you to…
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now