DoCmd.TransferText loads blank rows (1 Viewer)

mik

Lost in a VBA Jungle
Local time
Tomorrow, 04:38
Joined
Nov 16, 2004
Messages
22
Hi, if I do a transfertext in a macro, the data loads correctly, however, when I use VBA attached to a button, the rows are loaded, but the fields are blank. What am I doing wrong?

VBA from button;
Private Sub Command0_Click()
DoCmd.RunSQL "DELETE MSC_load.* FROM MSC_load"
DoCmd.TransferText asImportFixed, "MSC_ddmmyy_ssss Import Specification", "MSC_Load", "C:\MSC.txt", False
End Sub

(delete command works correctly)

Macro Variables;
Transfer Type Import Fixed Width
Specification Name MSC_ddmmyy_ssss Import Specification
Table Name MSC_Load
Has Field Names C:\MSC.txt
HTML Table Name
Code Page

(HTML... and Code... are left blank)
 

mik

Lost in a VBA Jungle
Local time
Tomorrow, 04:38
Joined
Nov 16, 2004
Messages
22
Figured this one out

VBA from button;
Private Sub Command0_Click()
DoCmd.RunSQL "DELETE MSC_load.* FROM MSC_load"
DoCmd.TransferText asImportFixed, "MSC_ddmmyy_ssss Import Specification", "MSC_Load", "C:\MSC.txt", False, ""
End Sub

Don't know what the [,""] does, but it fixed the problem
 

Pat Hartman

Super Moderator
Staff member
Local time
Today, 13:38
Joined
Feb 19, 2002
Messages
42,971
You could find out by looking up TransferText in help. Thanks for sharing the solution though.
 

Users who are viewing this thread

Top Bottom