I am attempting to create a table within a database which stores documents.
How do I upload the file to a network location, rename the file by concatenating two fields from the document table form (eliminating the issue of duplicate file names in the external location), and store the file name and file path in a file path field in the table?
Option Compare Database
Private Sub Command15_Click()
Dim f As Object
Set f = Application.FileDialog(3)
f.AllowMultiSelect = False
If f.Show Then
For i = 1 To f.SelectedItems.Count
sFile = Filename(f.SelectedItems(i), sPath)
MsgBox sPath & "---" & sFile
Next
End If
End Sub
Public Function Filename(ByVal strPath As String, sPath) As String
sPath = Left(strPath, InStrRev(strPath, "\"))
Filename = Mid(strPath, InStrRev(strPath, "\") + 1)
End Function
ms access browse for file and get file name and path
VBA to copy a file from one directory to another
I am using Microsoft Access 2010, and I do not wish to use the file attachment field type because of database size constraints. I press a button and a file explorer appears to navigate to the file being uploaded, and the path and file name are entered into strings.
One is an account number with hyphens and the other is the id field of the current document in the documents table which I have just set to an incremental number.

