The line below codes the vba code that keeps erroring out with a "[31519]: You cannot import this file" message. According to the Access 2003 VBA Language Reference, TransferText Method, the syntax is used correct. expression.TransferText(TransferType, SpecificationName, TableName, FileName, HasFieldNames, HTMLTableName, CodePage. -
expression.TransferText(TransferType, SpecificationName, TableName, FileName, HasFieldNames, HTMLTableName, CodePage.
-
below is my code: -
DoCmd.TransferText acImportDelim, "Credit_Memo", "L:\UH_Warehouse_Reporting\SciQuestData\Credit_Memo.csv", True
-
Any suggestions would be appreciated.
The importspec is the details of how the import is meant to run. For instance, in the DoCmd.Transfertext, you have specified that there is a delimiter, but you have not specified what the delimiter is! Such a thing among others are specified in an import spec. If you manually import the file the first time, you can specify such settings, and then save the import spec.
8 5976
Does the import work when you do it manually?
yes, i can import it in access as a csv file.
You seem to be missing an argument in your syntax. ITs either the specification name or the table name.
i can't seem to locate the error. the credit_memo and the path file appear to be intact.
for time efficiency, the statement was converted into an excel import statement.
however, i welcome any suggestions.
Did you fix the missing argument? - DoCmd.TransferText _
-
transferType:=acImportDelim, _
-
SpecificationName:="Credit_Memo", _
-
TableName:="", _
-
FileName:="L:\UH_Warehouse_Reporting\SciQuestData\Credit_Memo.csv", _
-
HasFieldNames:=True
From your code, I can't guess whether Credit_Memo is your table name or the name of your importspec, but one or the other is missing. I have typed it out differently for you, which may make it more clear what is happening.
i'm having difficultly understanding what an import spec is? the credit_memo is the name of the access table. The following is the vba procedure in full, line 48 is where the executable statement is: -
Private Sub ImportRecords()
-
-
On Error GoTo Err_Hndlr
-
-
-
If TableExists("SO_Data") Then
-
' delete the table if it exists
-
DoCmd.DeleteObject acTable, "SO_Data"
-
End If
-
If TableExists("SO_Data$_ImportErrors") Then
-
' delete the table if it exists
-
DoCmd.DeleteObject acTable, "SO_Data$_ImportErrors"
-
End If
-
-
-
If TableExists("SO_CFHeader") Then
-
' delete the table if it exists
-
DoCmd.DeleteObject acTable, "SO_CFHeader"
-
End If
-
If TableExists("SO_CFHeader$_ImportErrors") Then
-
' delete the table if it exists
-
DoCmd.DeleteObject acTable, "SO_CFHeader$_ImportErrors"
-
End If
-
-
If TableExists("Credit_Memo") Then
-
' delete the table if it exists
-
DoCmd.DeleteObject acTable, "Credit_Memo"
-
End If
-
If TableExists("Credit_Memo$_ImportErrors") Then
-
' delete the table if it exists
-
DoCmd.DeleteObject acTable, "Credit_Memo$_ImportErrors"
-
End If
-
-
-
MsgBox "Please be patient while application is uploading the contracts.", vbInformation
-
-
-
' import file
-
' DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, "SO_Data", "L:\UH_Warehouse_Reporting\SciQuestData\SO_Data.xls", True
-
' DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, "SO_CFHeader", "L:\UH_Warehouse_Reporting\SciQuestData\SO_CFHeader.xls", True
-
' 'DoCmd.TransferText acImportDelim, "Credit_Memo", "L:\UH_Warehouse_Reporting\SciQuestData\Credit_Memo.csv", True
-
' DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, "Credit_Memo", "L:\UH_Warehouse_Reporting\SciQuestData\Credit_Memo.xls", True
-
'
-
' FOR TESTING PURPOSES
-
-
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, "SO_Data", "C:\Documents and Settings\DowlinMM\My Documents\Development\UH Mgt Inventory Rptg\UH Mgt Inventory Rptg\Sciquest Data\SO_Data.xls", True
-
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, "SO_CFHeader", "C:\Documents and Settings\DowlinMM\My Documents\Development\UH Mgt Inventory Rptg\UH Mgt Inventory Rptg\Sciquest Data\SO_CFHeader.xls", True
-
'DoCmd.TransferText acImportDelim, "Credit_Memo", "L:\UH_Warehouse_Reporting\SciQuestData\Credit_Memo.csv", True
-
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel9, "Credit_Memo", "C:\Documents and Settings\DowlinMM\My Documents\Development\UH Mgt Inventory Rptg\UH Mgt Inventory Rptg\Sciquest Data\Credit_Memo.xls", True
-
-
-
MsgBox "Task Complete!", vbInformation
-
-
ImportRecords_Exit:
-
Exit Sub
-
-
-
Err_Hndlr:
-
MsgBox "[" & Err.Number & "]: " & Err.Description, vbInformation, "ImportRecords()"
-
End Sub
-
The importspec is the details of how the import is meant to run. For instance, in the DoCmd.Transfertext, you have specified that there is a delimiter, but you have not specified what the delimiter is! Such a thing among others are specified in an import spec. If you manually import the file the first time, you can specify such settings, and then save the import spec.
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Emil Karlen |
last post by:
Using the import-tag, a template appearing in the imported file, can be
extended in the importing file.
I am extending a template this way and in the main-file, inside the
template use...
|
by: David Lozzi |
last post by:
Hello,
I need to automate importation of a excel file into a table. Here's my
scenario: I'm writing an ASP.NET application where users can pull reports on
imported data. The imported data is...
|
by: Tim Gains |
last post by:
can someone instruct me as to how to load a binary file and the import it's
data (rows pf data) into a database? Do I need to convert the binary file in
any way in order to decipher it's data. Any...
|
by: gmarkowsky |
last post by:
Hi all,
I'm trying to import a class from a module. The class looks like this:
class App:
def __init__(self, master):
frame = Frame(master)
frame.pack()
|
by: owz |
last post by:
I am trying 2 load details about cars from a.txt file
and then display the total stock value off all cars.
public class Car
{
// attributes
private String manufacturer;
private...
|
by: runway27 |
last post by:
presently i have a table in which there are records and the fields are slno (this is a primary key auto increment), firstname, lastname, email, date(which inserts as a date format) these records are...
|
by: Sudhakar |
last post by:
presently i have a table in which there are records and the fields are
slno (this is a primary key auto increment), firstname, lastname,
email, date(which inserts as a date format) these records...
|
by: thread |
last post by:
hi all
does anyone knows how to import/link a file that sits on a server
for now everytime im trying to import,im getting a message connect to
server but then it is cenceled
any ideas
|
by: passionateforjava |
last post by:
Hi All,
I am using struts application wherein I need to import file for some purpose.I have used input type="file" for the same which goes like:
<input type="file" id="uploadFile" name="uploadFile"...
|
by: squirrelknight |
last post by:
Hello. I am new to Python. I've just installed version 3.0.1, which I will be using on a Linux box (which I am also new to), and need to use it to essentially call on several files of a specific...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
| |