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

How to split one field to many

P: n/a
I have a field called "notes".
I want to seperate this field to two and more.
the carachater "#" indicates the begining of a new field.
For example:
if "notes" is:
"My name is John # the name of my friend is jim # jim leaves in NY#"

In the new table (or query) I want to see:
Under the field "Notes": "My name is John"
Under the (new) field "Notes1": "the name of my friend is Jim"
Under the (new) field "Notes2": "jim leaves in NY"

Is it possible to seperate the field "notes" to three fields? How?

Thanks,

galsaba

Nov 13 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a

"galsaba" <ga*****@aol.com> ha scritto nel messaggio
news:11**********************@o13g2000cwo.googlegr oups.com...
I have a field called "notes".
I want to seperate this field to two and more.
the carachater "#" indicates the begining of a new field.
For example:
if "notes" is:
"My name is John # the name of my friend is jim # jim leaves in NY#"

In the new table (or query) I want to see:
Under the field "Notes": "My name is John"
Under the (new) field "Notes1": "the name of my friend is Jim"
Under the (new) field "Notes2": "jim leaves in NY"

Is it possible to seperate the field "notes" to three fields? How?

Thanks,

galsaba


Hi,
use the function for string manipulation -> Mid(), Instr(), Left(), Len()
etc...
Nov 13 '05 #2

P: n/a

"galsaba" <ga*****@aol.com> ha scritto nel messaggio
news:11**********************@o13g2000cwo.googlegr oups.com...
I have a field called "notes".
I want to seperate this field to two and more.
the carachater "#" indicates the begining of a new field.
For example:
if "notes" is:
"My name is John # the name of my friend is jim # jim leaves in NY#"

In the new table (or query) I want to see:
Under the field "Notes": "My name is John"
Under the (new) field "Notes1": "the name of my friend is Jim"
Under the (new) field "Notes2": "jim leaves in NY"

Is it possible to seperate the field "notes" to three fields? How?

Thanks,

galsaba


Example:

I have 2 field: CAP and another...

In a vba module declare the function...

Public Function DividiIndirizzo(IndirizzoUnico As String, PrimaDopo As
Integer) As String
Dim Conta As Integer
Dim Conta2 As Integer
Dim Pippo As String
DividiIndirizzo = ""
For Conta = 1 To Len(IndirizzoUnico) - 5
Pippo = ""
For Conta2 = 0 To 4
If IsNumeric(Mid(IndirizzoUnico, Conta + Conta2, 1)) Then
Pippo = Pippo & Mid(IndirizzoUnico, Conta + Conta2, 1)
End If
Next Conta2
If Len(Pippo) = 5 Then
If PrimaDopo = 1 Then
DividiIndirizzo = Left(IndirizzoUnico, Conta - 1)
Exit Function
Else
DividiIndirizzo = Mid(IndirizzoUnico, Conta)
Exit Function
End If
End If
Next Conta
End Function
-----------------
create a query with sql...

SELECT Tabella1.TuttoInsieme, DividiIndirizzo([TuttoInsieme],1) AS Campo1,
DividiIndirizzo([TuttoInsieme],2) AS Campo2
FROM Tabella1;-----------------Ok?
Nov 13 '05 #3

P: n/a
Ali
use split() function.

Nov 13 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.