Results 1 to 3 of 3
  1. #1
    glmleilei is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Apr 2015
    Posts
    4

    HELP!! import data and process in Access

    Hi friends,I have 4 csv files, that need to be imported into Access.
    1. I'm building 4 linked tables so users can update the table as needed. Then run queries based on these tables to produce report. But maybe there's a better way? the file name and location might be dymatic, so anything like 'getopenfilename' would be easier instead of linked tables?


    2. These data need to be clean up first to become a 'database table'. (Delete first 2 rows, delete some columns, remove duplicates etc.) I know how to do them in VBA Excel, but never used Macro in Access before. Please advise
    Thank you !!

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    Have the user pick a file using the Microsoft pick app

    usage:
    txtBox = UserPick1File("c:\folder\")


    Code:
    Public Function UserPick1File( Optional pvPath)
    Dim strTable As String
    Dim strFilePath As String
    Dim sDialog As String, sDecr  As String, sExt As String
    
    
    '===================
    'YOU MUST ADD REFERENCE : Microsoft Office 11.0 Object Library, in vbe menu, TOOLS, REFERENCES
    '===================
    
    With Application.FileDialog(msoFileDialogFilePicker)   
        .AllowMultiSelect = False
        .Title = "Locate a file to Import"
        .ButtonName = "Import"
        .Filters.Clear
        .Filters.Add "Excel Files", "*.xls;*.xlsx"
        .Filters.Add "All Files", "*.*"
        .InitialFileName = "c:\"
        .InitialView = msoFileDialogViewList    'msoFileDialogViewThumbnail
        
            If .Show = 0 Then
               'There is a problem
               Exit Function
            End If
        
        'Save the first file selected
        UserPick1File = Trim(.SelectedItems(1))
    End With
    End Function

  3. #3
    glmleilei is offline Novice
    Windows XP Access 2010 32bit
    Join Date
    Apr 2015
    Posts
    4
    Thanks so much!! worked perfectly!

    then i can import file by
    DoCmd.TransferSpreadsheet acImport, , "testspreasheet", UserPick1File, True

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 6
    Last Post: 07-31-2014, 12:53 PM
  2. Entering data for a manual process.
    By athyeh in forum Forms
    Replies: 4
    Last Post: 10-08-2013, 02:23 PM
  3. Import and process data
    By JOKER_ZA in forum Import/Export Data
    Replies: 13
    Last Post: 07-12-2013, 04:33 AM
  4. Replies: 7
    Last Post: 05-10-2012, 01:02 PM
  5. Basic Q's? on how Forms Process Entered Data.
    By tucker1003 in forum Access
    Replies: 2
    Last Post: 03-24-2011, 06:25 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums