How do I split a field that has multple values separated by comma

G

Guest

I have a field that store multiple values but need to split into separate
field.

E.g Field A contains value of A, B, C or it can contain A, C etc.

I need to split it to Field A-1, Field A-2 and Field A-3 etc.

Thanking in advance for any suggestion.
 
F

fredg

I have a field that store multiple values but need to split into separate
field.

E.g Field A contains value of A, B, C or it can contain A, C etc.

I need to split it to Field A-1, Field A-2 and Field A-3 etc.

Thanking in advance for any suggestion.

Add those fields to your table.

If you have Access 2000 or newer:
Copy and Paste the following into a Module:

Public Function ParseText(TextIn As String, X) As Variant
On Error Resume Next
Dim var As Variant
var = Split(TextIn, "-", -1)
ParseText = var(X)

End Function
===========

Then paste this SQL into a new Query.
Change YourTable to what ever the actual table name is...

Update YourTable Set YourTable.Field1 = ParseText([FieldNamel],0),
YourTable.Field2 = ParseText([FieldName],1),YourTable.Field3 =
ParseText([FieldName],2);
 

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