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

Transfer Text problem in Access VBA

P: n/a
I have a strange problem with a docmd.transfertext statement. I have
set up an import specification to transfer in a .txt file by fixed
width. When I do the import using the specification the file imports
just fine into the table. When I use the transfertext statement for
import the contents of the file are loaded into the first column. Has
anyone run into this problem and do they have any
suggestions/solutions?

Here is the code in Access VBA:

Dim dkg As Variant, filstr As String
dkg = Application.FileDialog(msoFileDialogFilePicker).Sh ow
filstr =
Application.FileDialog(msoFileDialogFilePicker).Se lectedItems(1)

DoCmd.TransferText , "NYImpSpec", "NYImport", filstr

The first three line only allow the user to select the file through a
file dialog box. The fourth line is where the problem lies.

Thanks for any help in advance.

Dave Christman

Jul 14 '06 #1
Share this Question
Share on Google+
1 Reply


P: n/a
You have to specify the type of file you are importing. The way you
have the statement written, you are using the default which is
acImportDelimited. You are importing a fixed width file. Try changing
your import statement to
DoCmd.TransferText acImportFixed, "NYImpSpec", "NYImport", filstr

Hope that helps!

Jul 14 '06 #2

This discussion thread is closed

Replies have been disabled for this discussion.