我試圖將選定的文件名和文件路徑保存到表中的字段中。我正在使用一個表單,並插入一個按鈕,並應用我在網上找到的一些代碼來獲取文件名和路徑到一個msgbox。MS Access - 將文件名和文件路徑保存到表中的字段
Private Sub Command0_Click()
Dim f As Object
Dim strFile As String
Dim strFolder As String
Dim varItem As Variant
Set f = Application.FileDialog(3)
f.AllowMultiSelect = True
If f.Show Then
For Each varItem In f.SelectedItems
strFile = Dir(varItem)
strFolder = Left(varItem, Len(varItem) - Len(strFile))
MsgBox "Folder: " & strFolder & vbCrLf & _
"File: " & strFile
Next
End If
Set f = Nothing
End Sub
有誰請幫我解釋一下我怎麼現在得到來自消息框所產生的數據放入我的表中的字段(場目的地被稱爲「ImageFilePath
」 &「ImageFileName
」)。
謝謝你們夥計
上的信息之後,將整個路徑保存到了我的字段中。這是基本的ms-access數據庫工作 - 查找添加新記錄並試用某些東西的示例。這不是您分享的相關代碼 – dbmitch