Link to home
Start Free TrialLog in
Avatar of Mac M
Mac MFlag for United States of America

asked on

Import into Access Table from Excel

How do I create an Import Table in Access for a monthly raw (May, June, etc) data tab in Excel that I can use monthly to capture the new raw_data?
Avatar of Dale Fye
Dale Fye
Flag of United States of America image

When I'm importing from Excel, I generally use the TransferSpreadsheet method to create a linked table in Access.  Then I move that data from the linked table into a staging table which I use to assess the validity of the data and identify records with invalid data, to either avoid importing, or to provide a written report to the user.  Then once the user has identified the records to actually be uploaded, I import those records into my production table(s).

So the first step would be to use the Transfer Spreadsheet method to link the worksheet into Access
Avatar of Mac M

ASKER

Good morning Dale, do you have a code to import from Excel and append to an existing table in Access that will not allow duplicates and error handling. My code has a error at line:

 'If FileExist(filepath).  thanks for your support...

Private Sub Command665_Click()
Dim filepath As String
Dim User As String

User = Environ("username")
filepath = "T:\Users\" & User & "\Documents\Test2.xlsx"
If FileExist(filepath) Then

DoCmd.TransferSpreadsheet acImport, , "TblTest", filepath, True
Else
    MsgBox "File not Found. Please check filename or file location. Contact Administrator"
   
End If
End Sub
ASKER CERTIFIED SOLUTION
Avatar of Dale Fye
Dale Fye
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Mac M

ASKER

Thanks Dale for the awesome and thorough help...