Results 1 to 5 of 5
  1. #1
    Lounger
    Join Date
    Jul 2006
    Posts
    28
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Getting a file name (Access Any Version)

    I need to get the file name of a file (for example "C:anyfile.xls") into a text box in Access using something like a Browse button that opens up an Open dialogue box so I can choose the file.

    Is there a way I can do this?

  2. #2
    Super Moderator
    Join Date
    Jun 2002
    Location
    Mt Macedon, Victoria, Australia
    Posts
    3,993
    Thanks
    1
    Thanked 45 Times in 44 Posts

    Re: Getting a file name (Access Any Version)

    I attach a demo that shows you two ways to do it.

    How you do it depends on the version of Access you are using.

    The form frmSelectfileUsingmodOpenfile will work in any version of Access, but requires that you import the module modOpenfile into the database.

    The form frmSelectFileXP will work in newer versions of Access (XP onwards from memory) without having to import modOpenfile . Instead you need to set a Reference to the Microsoft Office Object Library.
    Attached Files Attached Files
    Regards
    John



  3. #3
    Lounger
    Join Date
    Jul 2006
    Posts
    28
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Getting a file name (Access Any Version)

    THanks for that - it worked great!

  4. #4
    2 Star Lounger
    Join Date
    Jan 2005
    Location
    Wichita, Kansas, USA
    Posts
    209
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Getting a file name (Access Any Version)

    How does one "set a Reference to the Microsoft Office Object Library"?

  5. #5
    5 Star Lounger
    Join Date
    Aug 2004
    Location
    Connecticut, USA
    Posts
    816
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Getting a file name (Access Any Version)

    From within the VBA area, go to Tool/References... Scroll down until you find the Microsoft Office Object Library listing. Check the box next to the listing and OK out.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •