JazzSP8
Well-known Member
- Joined
- Sep 30, 2005
- Messages
- 1,233
- Office Version
- 365
- Platform
- Windows
Hey All
I'm trying to use VBA to link a "csv" file as a table that has semi colons as a delimiter.
If I use 'External Data > New Data Source > From File > Text File' and set the semi colon as the delimeter then it links as I'd expect it to do.
I can get the file to link using VBA but all the data appears in one field.
I've been Googling around and apparantly I needed to create a "schema.ini" file to be able to use the semi colon as a delimiter, which I've tried to do but it doesn't seem to be working.
This is what I've got;
I've tried variations on a theme but I can't get it to work - The code above is what I think should work based on what I read but I seem to be missing something, somewhere.
Thanks for looking.
I'm trying to use VBA to link a "csv" file as a table that has semi colons as a delimiter.
If I use 'External Data > New Data Source > From File > Text File' and set the semi colon as the delimeter then it links as I'd expect it to do.
I can get the file to link using VBA but all the data appears in one field.
I've been Googling around and apparantly I needed to create a "schema.ini" file to be able to use the semi colon as a delimiter, which I've tried to do but it doesn't seem to be working.
This is what I've got;
VBA Code:
Sub FnB()
Open CurrentProject.Path & "\schema.ini" For Output As #1
Print #1, "[All Attributes.csv]"
Print #1, "ColNameHeader=True"
Print #1, "Format=Delimited(;)"
Close #1
DoCmd.TransferText TransferType:=acLinkDelim, TableName:="FnB", FileName:=CurrentProject.Path & "\All Attributes.csv", HasFieldNames:=True
End Sub
I've tried variations on a theme but I can't get it to work - The code above is what I think should work based on what I read but I seem to be missing something, somewhere.
Thanks for looking.