|
-
Jun 12th, 2002, 04:02 PM
#1
Thread Starter
Member
Remove Text Qualifier From CSV File
How would I go about stripping out the text qualifier from a CSV file?
" is the qualifier.
This is what I have and it works as long as there is no qualifier
Code:
Dim arrData() As String
Dim s As Variant
Dim i As Integer
Open "Filename" For Input As #1
Do While Not EOF(1)
rs.AddNew
Line Input #1, s
arrData = Split(s, ",")
For i = 0 To UBound(arrData)
'Debug.Print arrData(i)
rs!TRANS_ID = arrData(0)
rs!CO = arrData(1)
rs!FACid = arrData(2)
Thanks for any and all help...
I'm a misanthropic philanthropist!
Frog, the only white meat...
-
Jun 12th, 2002, 04:14 PM
#2
If each line (record) has the same number of fields, you could do this:
VB Code:
For intTemp1 = 1 To intFields
Input #1, strField(intTemp1)
Next intTemp1
Otherwise, you will need to write a function that looks for a quote at the beginning of the record, and if it finds one, looks for the next quote and strips off the field, removes the quotes and comma, and then repeats until the record is empty.
-
Jun 12th, 2002, 04:15 PM
#3
Member
Use Replace()
You may use the Replace function...
ex.
strText ="Hola..."
strText=Replace(strText,".","")
this give a result like this:
"Hola"
the first parameter is the string to process, the second is the character to find, and the last parameter is the character to put in change of the second parameter...
I hope this would help you...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|