Access Import Of Spreadsheet Or Table

I received an email question about the
difference in importing an Access object
versus an Excel spreadsheet.

In this video you are going to
find out how to import your
spreadsheet or table using the
access import feature and vba.

Option Compare Database

'========================================================
'DATABASE DESIGNED & CODED BY LOEBLCOM SERVICES 2013
'ERIK LOEBL(713)409-7041
'EMAIL: erik@loeblcomservices.com
'WEB:   http://loeblcomservices.com
'========================================================

Dim m_strFileName As String

Private Sub btnDBTable_Click()
    DoCmd.TransferDatabase acImport, "Microsoft Access", m_strFileName, acTable, "Customers", "Customers_Local", False
    
End Sub

Private Sub btnImportSS_Click()
    DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel8, "spreadsheet name", m_strFileName, True

End Sub

Private Sub btnLocateFile_Click()


    Dim varItem As Variant
    Dim strPath As String
    Dim objFilePicker  As FileDialog
    Dim db As Database
    Dim rst As DAO.Recordset
    Dim strUnitNumber As String
    
    Set db = CurrentDb()
    Set objFilePicker = Application.FileDialog(msoFileDialogFilePicker)
    
    With objFilePicker
        'Setup file dialog
        .AllowMultiSelect = False
        .ButtonName = "Select"
        .InitialView = msoFileDialogViewList
        .Title = "Select File"
        
        'add filter for all files
        With .Filters
         .Clear
         .Add "All Files", "*.mdb,*.accdb,*.xlsx"
        End With
        .FilterIndex = 1
        'disply dilog boxe
        .Show
    End With
    
    If objFilePicker.SelectedItems.Count > 0 Then
        
        m_strFileName = objFilePicker.SelectedItems(1)
        Me.txtImportFile = m_strFileName
        
    End If


End Sub

Click here for the database and the code:
Access Import Of Spreadsheet Or Table

Offsite Related Information:

“Go Fund Me” Page


($5 suggested amount)

(…10% of your gift amount will go to charity)

Free! Subscribe To Our YouTube Channel!

Free MS Access VBA Programming Course

Facebooktwitterredditpinterestlinkedinmailby feather
Tags: , , , , , ,