Row to Column

C

ChoonBoy

Thanks in advance for the help I will be receiving.

I want to convert memo field's content to column.

My memo field has the following contents and I need to move it to a column
using the "/" to determine the break.

Content example
www.microsoft.com/communities/newsgroups/en-us/default.aspx/dg=microsoft.public/access.formscoding

Result in a column.

www.microsoft.com
communities
newsgroups
en-us
default.aspx
dg=microsoft.public
access.formscoding

How do I do this using simple code or macros.

Thanks
 
S

Stuart McCall

ChoonBoy said:
Thanks in advance for the help I will be receiving.

I want to convert memo field's content to column.

My memo field has the following contents and I need to move it to a column
using the "/" to determine the break.

Content example:
www.microsoft.com/communities/newsgroups/en-us/default.aspx/dg=microsoft.public/access.formscoding

Result in a column.

www.microsoft.com
communities
newsgroups
en-us
default.aspx
dg=microsoft.public
access.formscoding

How do I do this using simple code or macros.

Thanks

Dim a As Variant, path As String, item As Variant

'shortened for this example
path = "www.microsoft.com/communities/newsgroups"

a = Split(strPath, "/")

For Each item In a
Debug.Print item
Next

Result:

www.microsoft.com
communities
newsgroups
 
C

ChoonBoy

Thanks for the quick response.

How do I get the result into ColResult (ColumnName) of a table instead of to
the immediate window?

I modified your code as below:

Private Sub cmdSplit_Click()
Dim a As Variant, path As String, item As Variant

path = Me!Listing

a = Split(path, "/")

For Each item In a
Me!ColResult = item
Next

End Sub
 
J

John W. Vinson

Thanks for the quick response.

How do I get the result into ColResult (ColumnName) of a table instead of to
the immediate window?

I modified your code as below:

Private Sub cmdSplit_Click()
Dim a As Variant, path As String, item As Variant

path = Me!Listing

a = Split(path, "/")

For Each item In a
Me!ColResult = item
Next

End Sub

Open a Recordset, loop through the array, and use the AddNew method to create
new records. See the VBA help for OpenRecordset and for AddNew for example
code.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top