I am trying to find a way to have Access automatically create a folder in a SQL Server FileTable directory that corresponds with the record itself.
I was able to get the code working when inserting the directory onto the main common drive at our company, but I receive "Run-time error '75': Path/File access error" when attempting to make the directory the location of the FileTable. (The FileTable directory is on a different server, but the same network)
This is the code I am using:
Sub MakeFolder(strPath As String)
If Dir(strPath, vbDirectory) > vbNullString Then
Exit Sub
End If
MkDir strPath
End Sub
Private Sub Command5_Click()
MakeFolder "\\ServerName\mssqlserver\FileStream\DocumentStore" & Me.ID
Shell "explorer.exe" & " " & "\\ServerName\mssqlserver\FileStream\DocumentStore" & Me.ID, vbNormalFocus
End Sub
I am not very experienced in vba, so any advice would be appreciated. I am able to view and use that directory outside of Access without any issues, so I did not think it was a permissions issue but I feel like I must be missing something if the code works when using one directory but not another.
So this turned out to be something incredibly simple.
I just forgot to add a '\' at the end of the directory name, so it works perfectly now!