Solved

Import Excel Using Saved Import

Posted on 2013-01-11
3
272 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

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Empty Record being created 4 42
Check a field in Access on a Timer 1 29
Null or "" 28 52
Getting "Invalid Operation" Error when opening a Recordset 10 33
Whether you've completed a degree in computer sciences or you're a self-taught programmer, writing your first lines of code in the real world is always a challenge. Here are some of the most common pitfalls for new programmers.
You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Learn how to number pages in an Access report over each group. Activate two pass printing by referencing the pages property: Add code to the Page Footers OnFormat event to capture the pages as there occur for each group. Use the pages property to …
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

756 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