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

'========================================================
'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()

    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
         .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-Table.mdb




By the way, if you got or are getting value from the VBA information, please give me a tip, thanks!


These posts may help answer your question too...

How can I interact with other Office applications (Excel) using VBA in Access?

Need to write your Access data or query to an Excel file? Here is the how to do it: Most people are familiar with Excel and know how to use it well (enough), and when you start talking about Access, they get scared off, and don’t know what to do anymore. Well, here you are […]

How To Generate A XML File With Access VBA

XML is used to structure your data. You can send a CSV file to another person, but using XML, you can structure your data in a more elegant format, and get very specific about your fields, and what data is contained within your tags (your field names). This is different than a basic CSV file […]

Mouse Click Counter On Access Form

This post will demonstrate how you can count the number of clicks on your button in a certain time frame. It will function like a game . Here is the database form all in one: Option Compare Database Public m_dteStartTime As Date Public m_dteStopTime As Date Private Sub btnClicker_Click() Dim intValue As Integer Dim rst […]

Shared Access Database Management

Here is a handy setup for those who need to manage a shared access database. Either you can create this from scratch as per the example or add the new tables to your existing database. This setup will track: 1. the users currently using the database 2. what time the user and computer name currently […]

Previous Post

MS Access Login Form Revised

Next Post

Shell VBA function