ACCDB file using VBA. I am looking for a specific folder in the path of the database location. It will always be 3 deep from the file, but the depth in the drive is variable. I grabbed the project path, split it, but can’t find a function to reverse it. Is there a built-in function or do you have to code it yourself. I have looked around and surprisingly can’t find the solution anywhere.
Dim pth As String
Dim apth As String
pth = Application.CurrentProject.Path
apth = Split(pth, "\")
'Reverse array here
apth = apth(2) 'Grab second index
MsgBox (apth) 'confirm folder
Call search_Project(apth)
there are a couple issues with the code like you can declare a string and then try and use it as an array. Below is the modified using the length of the array and subtracting 3 to get the position you want. I also added a check to ensure the length of the array is atleast 3 elements. Removed the as String for apth as you want to use it as an array.