Results 1 to 8 of 8
  1. #1
    Doodlebug2000 is offline Novice
    Windows XP Access 2003
    Join Date
    Nov 2012
    Posts
    5

    Be able to choose a file on C drive before importing/querying?

    Hi All,

    I created a button on an access form that allows me to import a specific file and re-arrange the data in a certain order. However, when I hit this button, I want the option to choose which I want to import from somewhere in my C drive. How would I do this?



    Also I'm not really a programmer so go easy on me!

  2. #2
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,725

  3. #3
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Here's a M$oft article with example.
    http://msdn.microsoft.com/en-us/libr.../ff835934.aspx
    This is of interest to me. That code referenced certainly is a bit shorter than the VBA code I have been using for this for years. I have been using Ken Getz's code here: http://access.mvps.org/access/api/api0001.htm

    However, with Ken's code, you can specify a default directory that the file dialog box will start in. Can you do that with the Microsoft code? I would love to use this shorter version, if that can be done.

  4. #4
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,725
    I think the default directory for the file picker is the same folder in which the MDB/ACCDB file is located.

    A quick look shows this
    Code:
    .InitialFileName = "c:\*.*"   ' or your choice
    should work.

    Good luck.

  5. #5
    JoeM is offline VIP
    Windows XP Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    I think the default directory for the file picker is the same folder in which the MDB/ACCDB file is located.

    A quick look shows this
    Code:
    .InitialFileName = "c:\*.*" ' or your choice
    should work.
    Excellent! Thanks!

  6. #6
    Doodlebug2000 is offline Novice
    Windows XP Access 2003
    Join Date
    Nov 2012
    Posts
    5
    Quote Originally Posted by JoeM View Post
    This is of interest to me. That code referenced certainly is a bit shorter than the VBA code I have been using for this for years. I have been using Ken Getz's code here: http://access.mvps.org/access/api/api0001.htm

    However, with Ken's code, you can specify a default directory that the file dialog box will start in. Can you do that with the Microsoft code? I would love to use this shorter version, if that can be done.
    I saw that link before but copied and pasted into a blank VBA code but only got errors. Is there a step by step procedure anywhere on how to implement it?

  7. #7
    Doodlebug2000 is offline Novice
    Windows XP Access 2003
    Join Date
    Nov 2012
    Posts
    5
    Quote Originally Posted by JoeM View Post
    This is of interest to me. That code referenced certainly is a bit shorter than the VBA code I have been using for this for years. I have been using Ken Getz's code here: http://access.mvps.org/access/api/api0001.htm

    However, with Ken's code, you can specify a default directory that the file dialog box will start in. Can you do that with the Microsoft code? I would love to use this shorter version, if that can be done.
    Can anyone provide step by step insight on how to implement this? this link has been showing up all day that i've been seearching for this
    thx

  8. #8
    orange's Avatar
    orange is offline Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,725

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

Similar Threads

  1. Replies: 10
    Last Post: 03-04-2012, 12:17 AM
  2. View .txt file on hard drive
    By nfaunt in forum Programming
    Replies: 0
    Last Post: 04-04-2011, 09:49 AM
  3. Output tables to an excel file on a network drive
    By GraemeG in forum Import/Export Data
    Replies: 1
    Last Post: 04-01-2011, 03:06 PM
  4. XML file not importing all fields
    By ButlerEagle in forum Access
    Replies: 0
    Last Post: 05-17-2010, 10:39 AM
  5. Importing Txt file via Vb
    By jquickuk in forum Import/Export Data
    Replies: 1
    Last Post: 04-01-2009, 08:27 AM

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