Being More Specific In Access Import

In this video will help you be more specific in your access import.
You will find out how to insert a name of the table you want to import.

Option Compare Database

'ERIK LOEBL(713)409-7041

Dim m_strFileName As String

Private Sub btnDBTable_Click()

    Dim strTableName As String
    strTableName = InputBox("What's the name of the table you want to import?")
    DoCmd.TransferDatabase acImport, "Microsoft Access", m_strFileName, acTable, strTableName, strTableName & "_Local", False
    MsgBox "Finished Importing Table."
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
         .Add "All Files", "*.mdb,*.accdb,*.xlsx"
        End With
        .FilterIndex = 1
        'disply dilog boxe
    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:

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