I am using an access to store images. I have created a button which the user can click on and it opens an explorer window allowing the user to browse for an image file. When the user clicks "Save" the image's file name is stored in strInputFileName, and this code is run:
If Not strInputFileName = "" Then
Me.Cover.SourceDoc = strInputFileName
If Not IsNull(Me.Cover.SourceDoc) Then
HasUpdate = True
Me.Cover.Action = acOLECreateEmbed
End If
End If
It works, too, except that after the above code snippet runs I cannot open the browse window again (the browse code I use works time and time again if I comment out the above 7 lines, so I'm certain the problem is there).
The full code for the "on click" function is below. I've been fighting this for 3 days, so any help would be greatly appreciated.
Private Sub cmdAddCover_Click()
Dim strFilter As String
Dim lngFlags As Long
Dim strInputFileName As String
strFilter = ahtAddFilterItem(strFilter, "Image Files (*.jpg, *.gif)", "*.JPG;*.GIF;*.BMP;*.TGA")
strFilter = ahtAddFilterItem(strFilter, "All Files (*.*)", "*.*")
strInputFileName = ahtCommonFileOpenSave(InitialDir:="C:\", _
Filter:=strFilter, FilterIndex:=3, Flags:=lngFlags, _
DialogTitle:="Browse for Cover Photo ...")
' Since you passed in a variable for lngFlags,
' the function places the output flags value in the variable.
MsgBox strInputFileName
Debug.Print Hex(lngFlags)
If Not strInputFileName = "" Then
Me.Cover.SourceDoc = strInputFileName
If Not IsNull(Me.Cover.SourceDoc) Then
HasUpdate = True
Me.Cover.Action = acOLECreateEmbed
End If
End If
End Sub
If Not strInputFileName = "" Then
Me.Cover.SourceDoc = strInputFileName
If Not IsNull(Me.Cover.SourceDoc) Then
HasUpdate = True
Me.Cover.Action = acOLECreateEmbed
End If
End If
It works, too, except that after the above code snippet runs I cannot open the browse window again (the browse code I use works time and time again if I comment out the above 7 lines, so I'm certain the problem is there).
The full code for the "on click" function is below. I've been fighting this for 3 days, so any help would be greatly appreciated.
Private Sub cmdAddCover_Click()
Dim strFilter As String
Dim lngFlags As Long
Dim strInputFileName As String
strFilter = ahtAddFilterItem(strFilter, "Image Files (*.jpg, *.gif)", "*.JPG;*.GIF;*.BMP;*.TGA")
strFilter = ahtAddFilterItem(strFilter, "All Files (*.*)", "*.*")
strInputFileName = ahtCommonFileOpenSave(InitialDir:="C:\", _
Filter:=strFilter, FilterIndex:=3, Flags:=lngFlags, _
DialogTitle:="Browse for Cover Photo ...")
' Since you passed in a variable for lngFlags,
' the function places the output flags value in the variable.
MsgBox strInputFileName
Debug.Print Hex(lngFlags)
If Not strInputFileName = "" Then
Me.Cover.SourceDoc = strInputFileName
If Not IsNull(Me.Cover.SourceDoc) Then
HasUpdate = True
Me.Cover.Action = acOLECreateEmbed
End If
End If
End Sub