Results 1 to 3 of 3
  1. #1
    JFerna777 is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Apr 2014
    Posts
    1

    Select file to import

    I wan to browse a directory and select a file and transfer the data to an ms-access table. I'm looking for VB code in MS-Access 2007.

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    I split your question off from thread you attached it to. One way to select a file:

    http://access.mvps.org/access/api/api0001.htm
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    yes, load pbaldy's code as a class called cCommonDialog.
    Then your code can say:

    vFile = UserPickFile("X") '(X is my code for Excel files, T=text files, etc)

    Code:
    Public Function UserPickFile(ByVal pvFilter, Optional pvPath)
    Dim clsCmn As New cCommonDialog
    Dim vFile
    With clsCmn
    .InitDir = pvPath .FilterCode = pvFilter .ShowSave UserPickFile = .Filename
    End With Set clsCmn = Nothing End Function
    Last edited by ranman256; 04-28-2014 at 01:52 PM. Reason: code box

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

Similar Threads

  1. Select and import subgroup
    By Szymon in forum Access
    Replies: 1
    Last Post: 03-06-2014, 12:15 PM
  2. Import of a .WRI-file
    By rndmxy2k13 in forum Access
    Replies: 1
    Last Post: 09-23-2013, 11:42 AM
  3. Import Excel file based on a date and time in file name
    By nhylan in forum Import/Export Data
    Replies: 4
    Last Post: 04-16-2013, 03:26 PM
  4. Import Row 1 Only on a .txt File
    By newbie in forum Import/Export Data
    Replies: 2
    Last Post: 02-08-2011, 08:23 AM
  5. Import a .sql file?
    By Alan in forum Import/Export Data
    Replies: 1
    Last Post: 06-03-2009, 07:52 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