У меня есть кнопка, которая вставляет гиперссылку в новую запись.Для свойства IsHyperlink этого поля установлено значение «да», поэтому я взял руку, но щелчок по вставленному пути никуда не денется.Я считаю, что кнопка обновляет запись, указав путь к файлу как «текст для отображения», а не как «адрес».
Private Sub MSDS_btn_Click()
Dim fd As Office.FileDialog
'Create a FileDialog object as a File Picker dialog box.
Set fd = Application.FileDialog(msoFileDialogFilePicker)
'Use a With...End With block to reference the FileDialog object.
With fd
'Set the initial path to the D:\Documents\ folder.
.InitialFileName = "D:\Documents\"
.Title = "Select MSDS"
'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![Link MSDS] = .SelectedItems(1)
**
'If the user presses Cancel...
Else
End If
End With
'Set the object variable to Nothing.
Set fd = Nothing
End Sub
Я знаю, что добавление следующего кода в ** работает в ExcelЯ за что-то вроде этого будет работать в Access!
ActiveSheet.Hyperlinks.Add Anchor:=Cells(ActiveCell.row, Range("LinkCol").Column), Address:=.SelectedItems(1), TextToDisplay:="MSDS"