Solved

Import Excel Using Saved Import

Posted on 2013-01-11
3
279 Views
Last Modified: 2013-01-14
I'm trying to import an Excel file into a Table in my application using

DoCmd.TransferSpreadsheet , , "Ledger_Import", strFileName

It is giving me an error that says "F1 is not in Ledger_Import" but there is no F1 column heading in the Excel sheet. Can I use a saved import specification to identify which columns are text and which are numbers and to make the upload go smoothly? Any other suggestions welcomed.

Thanks.
0
Comment
Question by:Buck_Beasom
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 120

Accepted Solution

by:
Rey Obrero (Capricorn1) earned 500 total points
ID: 38768626
first import the excel file and do all the necessary steps

select save the import

after you have done this you can use


docmd.RunSavedImportExport(SavedImportExportName)


the other method is

docmd.transferspreadsheet acimport, 10,"Ledger_Import", strFileName, true
0
 
LVL 74

Expert Comment

by:Jeffrey Coachman
ID: 38768941
<No Points wanted>

"F1" means "Field1", ...a generic name for the field if you forget to use the HasFieldNames argument of the TransferSpreadheet Action...
...or if the data has no field names.

So capricorn1's syntax will work just fine for you.

See the VBA Help Files for the TransferSpreadsheet Action/Method, ...for more detailed information.
0
 

Author Closing Comment

by:Buck_Beasom
ID: 38774156
As usual, Capricorn1 gets me right out of the woods on the first try!
0

Featured Post

On Demand Webinar: Networking for the Cloud Era

Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Describes a method of obtaining an object variable to an already running instance of Microsoft Access so that it can be controlled via automation.
In Part II of this series, I will discuss how to identify all open instances of Excel and enumerate the workbooks, spreadsheets, and named ranges within each of those instances.
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
In Microsoft Access, learn how to use Dlookup and other domain aggregate functions and one method of specifying a string value within a string. Specify the first argument, which is the expression to be returned: Specify the second argument, which …

696 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question