Function - DoCmd.TransferText
Posted on 2010-08-24
There is a Function that seems to have stopped working properly (it was created in Access 2003, we now have Access 2007).
The below function uses a SELECT QUERY "Query to export data to Text File". After running the below Function, the following is displayed "Microsoft Office Access was unable to append all the data to the table.........
'Opens an MS Excel dialog box to gather path and file name.
'Path and file name are used in the DoCmd.TransferText function.
'The query "Query to export data to Text File", results are saved as
'a text delimited file to the path and file name
'collected from the user in the MS Excel dialog box.
Public Function Browse4Data ()
On Error GoTo Err_Browse4Data
Dim objsrc As Object
Dim strpath As String
Set objsrc = GetObject("", "Excel.application")
strpath = objsrc.Application.GetSaveAsFilename(InitialFilename:="h:\my documents\FileFolder\File Name.txt", fileFilter:="Text Files (*.txt), *.txt")
DoCmd.TransferText acExportDelim, , "Query to export data to Text File", strpath, No
Set objsrc = Nothing
Why is the "Microsoft Office Access was unable to append all the data to the table" dialog box appearing? It is using a SELECT query. The query works fine on its own.