[AccessD] LoadFromText giving error only for tables?

Bill Benson bensonforums at gmail.com
Thu Jun 5 20:39:58 CDT 2014


LoadFromText is failing only for tables? Is this expected? This is an
undocumented method and so I am not able to check through Access what I may
be doing wrong. The SaveAsText code which I found did not balk at tables. I
can think of several reasons why I would question whether LoadFromText would
actually work for tables... so the fact that the code bombs is not
surprising except that I feel I have complied with all arguments. The error
message is
	Error 2487
	The Object Type argument for the action or method is blank or
invalue"

The path to the text files is 
Strpath = "D:\Docs\zzzProgramming and Consulting\2014 Programming
Development\Lew\2014_06_05_19_58\"
Fil.Name would be something like "Table_ReminderDays.txt"

Thanks in advancio.

....
AC.OpenCurrentDatabase (strPath & "\" & strCreateName)
Set db = AC.CurrentDb
For Each Fil In FSO.GetFolder(strPath).Files
    If Fil.Name Like "*.txt" And InStr(Fil.Name, "_") > 0 Then
        Select Case Left(Fil.Name, InStr(Fil.Name, "_"))
        Case Is = "Form_"
            AC.LoadFromText acForm, Mid(Fil.Name, Len("Form_") + 1,
Len(Fil.Name) - 4 - Len("Form_")), strPath & "\" & Fil.Name
        Case Is = "Table_"
		'example:  Table_ReminderDays.txt
	            AC.LoadFromText acTable, Mid(Fil.Name, Len("Table_") +
1, Len(Fil.Name) - 4 - Len("Table_")), strPath & "\" & Fil.Name

        Case Is = "Module_"
            AC.LoadFromText acModule, Mid(Fil.Name, Len("module_") + 1,
Len(Fil.Name) - 4 - Len("module_")), strPath & "\" & Fil.Name
        Case Is = "Query_"
            AC.LoadFromText acQuery, Mid(Fil.Name, Len("Query_") + 1,
Len(Fil.Name) - 4 - Len("Query_")), strPath & "\" & Fil.Name
        Case Is = "Macro_"
            AC.LoadFromText acMacro, Mid(Fil.Name, Len("Macro_") + 1,
Len(Fil.Name) - 4 - Len("Macro_")), strPath & "\" & Fil.Name
        End Select
    End If
Next
AC.Quit

....



More information about the AccessD mailing list