Solved

Import Excel Using Saved Import

Posted on 2013-01-11
3
255 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
3 Comments
 
LVL 119

Accepted Solution

by:
Rey Obrero earned 500 total points
Comment Utility
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
Comment Utility
<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
Comment Utility
As usual, Capricorn1 gets me right out of the woods on the first try!
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

When you are entering numbers in a speadsheet, and don't remember what 6×7 is, you just type “=6*7" instead. It works in every cell! This is not so in Access. To enter the elusive 42 in a text box, you have to find a calculator, and then copy the re…
In a multiple monitor setup, if you don't want to use AutoCenter to position your popup forms, you have a problem: where will they appear?  Sometimes you may have an additional problem: where the devil did they go?  If you last had a popup form open…
Familiarize people with the process of retrieving data from SQL Server using an Access pass-thru query. Microsoft Access is a very powerful client/server development tool. One of the ways that you can retrieve data from a SQL Server is by using a pa…
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…

763 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

Need Help in Real-Time?

Connect with top rated Experts

7 Experts available now in Live!

Get 1:1 Help Now