Consulting

Results 1 to 4 of 4

Thread: Quick Access VBA help

  1. #1
    VBAX Newbie
    Joined
    Sep 2015
    Posts
    4
    Location

    Quick Access VBA help

    Hi, Apologies - I'm unsure how to post code into the forum.


    There is an issue InputPath. It does not like the network/server name. It will work fine when it is local (my documents) also tried using the drive mapping letter. Any suggestion at all?

    Here's my code:

    Public Function Import_Multi_Excel_Files()

    Dim InputFile As String
    Dim InputPath As String

    InputPath = "\\server\dfsroot$\Change\3\Impacts\testing\"
    InputFile = Dir(InputPath & "*.xlsx")





    Do While InputFile <> ""

    DoCmd.TransferSpreadsheet acImport, , "tests" & Format(Now(), "ddmmyy"), InputPath & InputFile, True, "Action Plan!"
    InputFile = Dir
    Loop

    End Function

  2. #2
    VBAX Guru
    Joined
    Mar 2005
    Posts
    3,296
    Location
    Can you "Browse" to the server & Folder?

  3. #3
    VBAX Newbie
    Joined
    Sep 2015
    Posts
    4
    Location
    Hi

    I've found the issue but unsure how to resolve it

    My input path "\\server\dfsroot$\Change\3\Impacts\testing has a number of subfolders. Rather than name each subfolder explicitly, I would like to search "testing" and its subfolders

    Does that make sense? Is it something you could possibly assist with?

    Many thanks

  4. #4
    VBAX Guru
    Joined
    Mar 2005
    Posts
    3,296
    Location
    Which version of Access are you using?
    Access 2000-2003 supported "Searchstrings" in VBA but later ones do not.
    There is plenty of code around to allow the user to browse to the required folder if that is what you want to do.
    You can also search folders and sub folders but you do need a target.
    So what exactly are you trying to do?

Tags for this Thread

Posting Permissions

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