PDA

View Full Version : Quick Access VBA help



p4nny
05-31-2017, 09:22 AM
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

OBP
05-31-2017, 11:16 AM
Can you "Browse" to the server & Folder?

p4nny
06-01-2017, 12:58 AM
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

OBP
06-01-2017, 01:59 AM
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?