Split a field into many

E

echorley

When I receive student testing data in CVS format, there is one field with
all of the student answers. For example, ABACCCDACADBBBAC.

How can I split that one field into one field per answer?
 
S

Stefan Hoffmann

hi,
When I receive student testing data in CVS format, there is one field with
all of the student answers. For example, ABACCCDACADBBBAC.
How can I split that one field into one field per answer?
You can't. You need to loop over the string, e.g.:

Dim Position As Long

For Position = 1 To Len(yourString)
MsgBox Mid(yourString, Position, 1)
Next Position



mfG
--> stefan <--
 
J

John Spencer

Use the Mid Expression in a query

SELECT Mid(AnswerField,1,1) as Q1
, Mid(AnswerField,2,1) as Q2
, MId(AnswerField,3,1) as Q3
, Mid(AnswerField,4,1) as Q4
....
FROM YourTable


In design view you would have multiple calculated fields.
Field: Q1: Mid(AnswerField,1,1)

Add in any other fields you wish to use.

'====================================================
John Spencer
Access MVP 2002-2005, 2007-2008
The Hilltop Institute
University of Maryland Baltimore County
'====================================================
 

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