Y
yesby
Hi
I have a form in Access 97 that contains a picture object ("ImageFrame1") and a command button ("Command241") next to it. The intent is for the user to click on the button, where a standard File Open dialog box is presented. The user then chooses a picture, and the path is a string value (strInputFileName1) passed to a field called "Photo1". The image is then displayed in the ImageFrame1 picture object and has a HyperlinkAddress property assigned to it ( = strInputFileName1). That allows the user to click on the picture object and open it in the defalut Windows image viewer.
The problem is that when the database is opened the pictures lose their hyperlink property, though the picture still appears. It there a way to get the form to tag the picture object with the correct HyperlinkAddress property at runtime when the record is accessed?
Thanks
Here is the code for the Command241 button,
------------------------------------------------------------------
Private Sub Command241_Click()
Dim strFilter As String
Dim strInputFileName1 As String
' Open a file dialog box
strFilter = ahtAddFilterItem(strFilter, "All Files (*.*)", "*.*")
strInputFileName1 = ahtCommonFileOpenSave( _
Filter:=strFilter, OpenFile:=True, _
DialogTitle:="Please select an input file...", _
Flags:=ahtOFN_HIDEREADONLY)
' Pass the image path to the field Photo1
Me.Photo1 = strInputFileName1
' Set the photos HyperlinkAddress property to the file name selected
Me![ImageFrame1].HyperlinkAddress = strInputFileName1
End Sub
---------------------------------------------------------------------------------------
Here is the code for the ImageFrame1 picture object on the form...
-----------------------------------------------------
Private Sub Form_Current()
On Error Resume Next
' Pass the image path to the Picture property of ImageFrame1 to display the picture.
Me![ImageFrame1].Picture = Me![Photo1]
I have a form in Access 97 that contains a picture object ("ImageFrame1") and a command button ("Command241") next to it. The intent is for the user to click on the button, where a standard File Open dialog box is presented. The user then chooses a picture, and the path is a string value (strInputFileName1) passed to a field called "Photo1". The image is then displayed in the ImageFrame1 picture object and has a HyperlinkAddress property assigned to it ( = strInputFileName1). That allows the user to click on the picture object and open it in the defalut Windows image viewer.
The problem is that when the database is opened the pictures lose their hyperlink property, though the picture still appears. It there a way to get the form to tag the picture object with the correct HyperlinkAddress property at runtime when the record is accessed?
Thanks
Here is the code for the Command241 button,
------------------------------------------------------------------
Private Sub Command241_Click()
Dim strFilter As String
Dim strInputFileName1 As String
' Open a file dialog box
strFilter = ahtAddFilterItem(strFilter, "All Files (*.*)", "*.*")
strInputFileName1 = ahtCommonFileOpenSave( _
Filter:=strFilter, OpenFile:=True, _
DialogTitle:="Please select an input file...", _
Flags:=ahtOFN_HIDEREADONLY)
' Pass the image path to the field Photo1
Me.Photo1 = strInputFileName1
' Set the photos HyperlinkAddress property to the file name selected
Me![ImageFrame1].HyperlinkAddress = strInputFileName1
End Sub
---------------------------------------------------------------------------------------
Here is the code for the ImageFrame1 picture object on the form...
-----------------------------------------------------
Private Sub Form_Current()
On Error Resume Next
' Pass the image path to the Picture property of ImageFrame1 to display the picture.
Me![ImageFrame1].Picture = Me![Photo1]