Re: Comma seprated string



I use this function for a job like you have:

Record is the string
Field is the delimitter, a comma in your case
VeldNr is the count of the field you want to isolate

Attribute VB_Name = "IsolateField"
Option Explicit

Public Function GetField(Record As String, Field As String, VeldNr As Integer) As String
'Isolate a field from a string
On Error GoTo FaultHandler
GetField = Split(Split(Record, Field)(VeldNr), ",")(0)
Exit Function
FaultHandler:
Select Case Err.Number
Case 9
Err.Clear
Exit Function
Case Err.Number
MsgBox "Fault in GetField Module: " + Str(Err.Number) + Chr$(13) + Chr$(10) + Chr$(10) + Error + " !", vbExclamation + vbOKOnly
Err.Clear
End Select
End Function


Regards, Akai

"Cathy" <Cathy@xxxxxxxxxx> wrote in message news:13tdkv1b67sf3c5@xxxxxxxxxxxxxxxxxxxxx
Thanks for previous assistance, I have now managed to install this on Vista

I have a string in VB that contains lots of dats seprated by commas

I am trying to think of a simple and easy method of extracting different values from this text string and placing them into variables.

Any suggestions on how best to do this?

TIA

C


.



Relevant Pages