我找到了一个表单,可以让您浏览文件并将它们附加到记录中,但它实际上会复制附件并将它们放入文件夹中,文件路径将保存在数据库中。这很好用......但是,我拆分数据库,多人将前端复制到他们的桌面并从那里开始工作。现在,这个代码设置在它将创建一个新文件夹或使用文件夹(如果已经创建了前端的位置),所以在这种情况下它实际上会在用户桌面上创建一个文件夹,这不是我想要的。我希望将所有附件移动到中央文件夹中的服务器,并让数据库从该文件夹中读取文件。这是代码:
const requestsWithCredentials = [
'/q/',
'/q/sw.js',
'/q/js/main.js',
'/q/js/init.js',
'/q/js/lib.js',
'/q/css/css.css',
'/q/images/b.jpg',
'/q/apps/BOK/js/main.js'
].map(url => new Request(url, {credentials: 'include'}));
// Later...
cache.addAll(requestsWithCredentials);
以下是编码的其余部分
Private Sub cmd_LocateFile_Click()
On Error GoTo Error_Handler
Dim sFile As String
Dim sFolder As String
Dim ID As Long
Dim sTarget As String
sFile = FSBrowse("", msoFileDialogFilePicker, "All Files (*.*),*.*")
If sFile <> "" Then
sFolder = Application.CodeProject.path & "\" & sAttachmentFolderName & "\"
If FolderExist(sFolder) = False Then MkDir (sFolder)
ID = RequestID_FK ' Set current record id.
sTarget = sFolder & CStr(ID) & "-" & GetFileName(sFile)
If CopyFile(sFile, sFolder & GetFileName(sTarget)) = True Then
Me!FullFileName.Value = sTarget
Else
End If
End If
Error_Handler_Exit:
On Error Resume Next
Exit Sub
Error_Handler:
MsgBox "The following error has occured" & vbCrLf & vbCrLf & _
"Error Number: " & Err.Number & vbCrLf & _
"Error Source: " & sModName & "\cmd_LocateFile_Click" & vbCrLf & _
"Error Description: " & Err.Description & _
Switch(Erl = 0, "", Erl <> 0, vbCrLf & "Line No: " & Erl) _
, vbOKOnly + vbCritical, "An Error has Occured!"
Resume Error_Handler_Exit
End Sub
答案 0 :(得分:0)
这不是评论中的有效字符串。常量字符串必须用双引号"mystring"
假设它是UNC路径,这应该有效:
sFolder = "\\aiowima23fp1\Ecological Sciences and Engineering\Cultural Resources\New - Cultural Resources Request Database\" & sAttachmentFolderName & "\"