英文:
MS Access - Saving link to another table with msoFileDialogFolderPicker , other then "me"
问题
我试图使用msoFileDialogFolderPicker保存链接位置。我想将链接保存在另一个名为"Characterization results"的表中的名为"PL Reports"的字段内。
我如何引用另一个表中的字段,类似于:PL Reports_Characterization results?
谢谢
英文:
I'm trying to save a link location using msoFileDialogFolderPicker. I want to save the link inside another table with the name of "Characterization results" to field named "PL Reports".
How i can refer to a field in another table like: PL Reports_Characterization results ?
Thanks
Private Sub Load_HyperlinkBTN_Click()
Const msoFileDialogFolderPicker As Long = 4
Dim fd As Object
'Create a FileDialog object as a File Picker dialog box.
Set fd = Application.FileDialog(msoFileDialogFolderPicker)
'Use a With...End With block to reference the FileDialog object.
With fd
'Set the initial path to the D:\Documents\ folder.
' InitialFileName = "\\ap1\tools\db\"
.Title = "Select Attachment"
'Use the Show method to display the File Picker dialog box and return the user's action.
'If the user presses the action button...
If .Show = -1 Then
' DoCmd.GoToRecord , "", acNewRec
Me![Charactisation results_PL Reports] = "#" & .SelectedItems(1) & "#"
' **
'If the user presses Cancel...
Else
End If
End With
'Set the object variable to Nothing.
Set fd = Nothing
End Sub
答案1
得分: 1
这将在表格“Characterization results”中插入一条新记录,并将值.SelectedItems(1)
保存到字段“PL Reports”中:
CurrentDb.Execute "INSERT INTO [Characterization results] ([PL Reports]) VALUES ('" & .SelectedItems(1) & "');", dbFailOnError
附注:正如@June7所指出的,您应该尽量避免在名称中使用空格。
英文:
This should insert a new record in table Characterization results
and save the value .SelectedItems(1)
in the field PL Reports
:
CurrentDb.Execute "INSERT INTO [Characterization results] ([PL Reports]) VALUES ('" & .SelectedItems(1) & "');", dbFailOnError
P.S. You should really avoid using space in names as @June7 stated.
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论