我有一个Access数据库(后端)。它的大小正在急剧增加,我确信这是因为我的主表中有一个附件字段。
我决定存储文件路径名,而不是文件本身;
我在这里发现了@Fionnuala,这是一个非常适合我的VBA例程和函数(我刚刚将AllowMultiSelect更改为FALSE)。
如何将选定的文件复制到网络文件夹,然后将其重命名为字段ID作为名称的一部分。就像ID &“lto.pdf”
ID是我主表中的一个字段;
复制后的文件名将是br,即O:/DOCS/678LTO.PDF
Private Sub Command7_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
'Here I need to copy the file to O:\DOCS
'And rename it as [ID] & “lto.pdf” resulting O:\DOCS\328LTO.pdf
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发布于 2018-07-17 08:34:11
'Here I need to copy the file to O:\DOCS
'And rename it as [ID] & “lto.pdf” resulting O:\DOCS\328LTO.pdf
FileCopy f.SelectedItems(i), "O:\DOCS\" & Your[ID] & "LTO.pdf"https://stackoverflow.com/questions/51376612
复制相似问题