Please remember that this is my first attempt.
I have tried the function name from the list on the module page,
("MembersExport"), and also from within the function. Code is below.
Each time the error message says "Can't find the macro"
I have used the expression builder which gave me this:
=[ImportDelimitedTextFile]
and an error message which says:
"The object does not contain the automation object
'ImportdelimitedTextFile'.
=====Code Follows =========
Option Compare Database
Option Explicit
'This function takes the following arguments
'strTextFilePath - The location of the Text File to be imported
'strTextFileName - The name of the Text File with its filename
extension (eg USHolidays.csv)
'strImportSpecName - The name of the Import Specification that you
created using the Import Text File Wizard
'strTableName - The Access table that you wish to create or populate
with the data from your imported text file
'blnHasFieldNames - Whether the file to be imported has field names as
its first row TRUE/FALSE
Function ImportDelimitedTextFile(strTextFilePath As String,
strTextFileName As String, strImportSpecName As String, _
blnHasFieldNames As Boolean, strTableName As String) As Boolean
DoCmd.TransferText TransferType:=acImportDelim,
SpecificationName:=strImportSpecName, TableName:=strTableName, _
FileName:=strTextFilePath & "\" & strTextFileName,
HasFieldNames:=blnHasFieldNames
'Set the return code of this function call in case we need to use it
later on for error trapping.....
ImportDelimitedTextFile = True
End Function
'Use this procedure to call the ImportDelimitedTextFile over and over
for each file we wish to import into a table.
Sub ImportMyTextFiles()
Dim blnRC As Boolean
'Import the D9790Database file into its own table
blnRC = ImportDelimitedTextFile(strTextFilePath:="E:\Downloads",
strTextFileName:="MembersExport.csv", _
strImportSpecName:="tMembersExport Link Specification",
blnHasFieldNames:=True, strTableName:="tMembersExport")
End Sub
Thanks,
Robin Chapple