Import specification

billmark

Registered User.
Local time
Today, 03:21
Joined
Mar 28, 2012
Messages
25
Hi
I am using MS Access 2010 and one import specification (called: excel1 import specification) is created in the application. Please advise how to modify the following codes so that this import specification will be used for the excel file imported:

QUOTE
Dim db As DAO.Database
Set db = CurrentDb
On Error Resume Next
db.TableDefs.Delete "PBXRAW"
On Error GoTo 0
db.TableDefs.Refresh
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel12Xml, "PBXRAW", "D:PAB.xlsx", True
db.TableDefs.Refresh
db.Close
Set db = Nothing

UNQUOTE

Regards
Bill
 
1. "D:\PAB.xlsx"

2. you dont need any code for this...it could all be done in a macro, but why delete the table?
You should empty the existing table then import data to it. Just attach the excel sheet as a table and run a query.

docmd.openquery "qdEmptyTbl"
docmd.openquery "qaImportData"

3. if you did you this code, you dont need an import spec for excel. only text.
Code:
On Error Resume Next
currentdb.TableDefs.Delete "PBXRAW"
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel12Xml, "PBXRAW", "D:\PAB.xlsx", True
 

Users who are viewing this thread

Back
Top Bottom