Soundsmith
Programmer
I need to regularly import several text files which will vary in overall width from month to month. They are fixed width files (data all lined up in columns, no delimiters but CRLF at end of line) but each file, each time, may be different width.
I created tblImport1 with 2 fields, F1, text 255 wide, and recnum, Autonumber field so I can track each line. I tried importing as acImportFixed, but don't understand how to create a specification for 255 char-wide line, so I used this:
etc. -
the import works just fine, except it truncates leading blanks. I don't care about trailing spaces, but I must have the positional accuracy to extract the data.
Is there a simple way to generate a fixed-file schema that I can reference? Or to tell TransferText to not ignore the leading spaces?
Thanks.
Thanks David 'Dasher' Kempton
The Soundsmith
I created tblImport1 with 2 fields, F1, text 255 wide, and recnum, Autonumber field so I can track each line. I tried importing as acImportFixed, but don't understand how to create a specification for 255 char-wide line, so I used this:
Code:
Public Function xferFile(fname As String) As Boolean
Dim xferName As String, fullnam As String, theFile As String
'On Error GoTo xferFile_Error
xferFile = True
fullnam = Trim(fname)
theFile = "tblImport1"
DoCmd.TransferText acImportDelim, , theFile, fullnam, False
the import works just fine, except it truncates leading blanks. I don't care about trailing spaces, but I must have the positional accuracy to extract the data.
Is there a simple way to generate a fixed-file schema that I can reference? Or to tell TransferText to not ignore the leading spaces?
Thanks.
Thanks David 'Dasher' Kempton
The Soundsmith