[AccessD] LoadFromText giving error only for tables?

Bill Benson bensonforums at gmail.com
Thu Jun 5 20:56:06 CDT 2014


I knew it was going to be an easy fix and additional headaches both...

So I have to use this
	AC.DoCmd.TransferText acImportDelim, , Mid(Fil.Name, Len("Table_") +
1, Len(Fil.Name) - 4 - Len("Table_")), strPath & "\" & Fil.Name, True

And having no import specification; Access is not going to recreate the
table properly.

So it would appear I will have to 
	1) create an import specification in the old database
	2a) copy the old tables from the model database using
Ac.DoCmd.TransferDatabase acTable... structure only
	Or
	3b) Loop the tables in the old database and record their name,
columns, column field types, column properties and attributes, table
properties, ... aye aye aye

I am not even sure if the LoadFromText does a good job of populating the
System tables with the queries that form the rowsource of the form
objects...

Anyone been down this road of creating a database from material on disk, and
know the gaps?

Thanks.

-----Original Message-----
From: Bill Benson [mailto:bensonforums at gmail.com] 
Sent: Thursday, June 05, 2014 9:40 PM
To: 'Access Developers discussion and problem solving'
Subject: LoadFromText giving error only for tables?

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