By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,220 Members | 1,372 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,220 IT Pros & Developers. It's quick & easy.

Trimming Data and inserting contents into new columns

P: 3
Hi there

I have a table which I have brought in from another database and need to seperate some of the data in one field where applicable into 2 fields. I've placed some examples below to explain further.

AQTF - Ext Scope
AQTF - First 12 Month
AQTF - Registration
AQTF - Re-registration
AQTF - Special
AQTF - Verification

You'll see for the sample data above, the first entry is just AQTF, whilst the following entries have something attached to it. Where the entries have something attached to it, I need to seperate them into AQTF (Column 1) and the remaining contents to be moved into a new Column.

Not quite sure what's the easiest way of doing this. Could you please advise?

Oct 3 '08 #1
Share this Question
Share on Google+
1 Reply

Expert 100+
P: 1,923
Try this:

Expand|Select|Wrap|Line Numbers
  1. Dim  NewColumn As String
  3. If InStr(Mid(Column1, 6, 1) , "-") <> 0 Then
  4.     Column1 = Left(Column1, 4)
  5.     NewColumn = Trim(Mid(Column1,7, Len(Column1)))
  6. End If   
Oct 3 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.