Этот код взят из проекта Access 2007, с которым я боролся.
Фактическая средняя часть - это часть, где я должен поместить что-то вроде «обновить только текущую форму»
DoCmd.RunSQL "Update Korut Set [PikkuKuva]=('" & varFile & "') ;"
Может кто-нибудь помочь мне с этим? `Если я использую его сейчас, он обновит все таблицы с одним и тем же выбранным файлом.
Вот весь код.
' This requires a reference to the Microsoft Office 11.0 Object Library.
Dim fDialog As Office.FileDialog
Dim varFile As Variant
Dim filePath As String
' Set up the File dialog box.
Set fDialog = Application.FileDialog(msoFileDialogFilePicker)
With fDialog
' Allow the user to make multiple selections in the dialog box.
.AllowMultiSelect = False
' Set the title of the dialog box.
.Title = "Valitse Tiedosto"
' Clear out the current filters, and then add your own.
.Filters.Clear
.Filters.Add "All Files", "*.*"
' user picked at least one file. If the .Show method returns
' False, the user clicked Cancel.
If .Show = True Then
' Loop through each file that is selected and then add it to the list box.
For Each varFile In .SelectedItems
DoCmd.SetWarnings True
DoCmd.RunSQL "Update Korut Set [PikkuKuva]=('" & varFile & "') ;"
Next
Else
MsgBox "You clicked Cancel in the file dialog box."
End If
End With