G
Guest
When a button (CommFind) is clicked the Windows dialog "GetOpenFileName"
appears. The user finds the file he wants to attach and clicks open.
I need that file to be saved to an Object field on the form (doc) but I get
the error 438:Object doesn't support this property or method in Form_Open.
How can I attach this file????????
Private Sub CommFind_Click()
' Purpose : Invokes the Windows Common Dialog GetOpenFileName function to
allow user to choose an image file
' Created/Modified : 8/15/07 By Dan Frisch,
On Error GoTo ErrHandler
Dim lngFlags As Long
Dim strFilter As String
strFilter = ahtAddFilterItem(strFilter, "Compressed Image Files (*.jpg,
*.jff, *.gif, *.tiff )", _
"*.JPG;*.JFF,*.GIF,*.TIF")
' strFilter = ahtAddFilterItem(strFilter, "dBASE Files (*.dbf)",
"*.DBF")
' strFilter = ahtAddFilterItem(strFilter, "Text Files (*.txt)",
"*.TXT")
strFilter = ahtAddFilterItem(strFilter, "All Files (*.*)", "*.*")
strPathAndFile = ahtCommonFileOpenSave(InitialDir:="C:\", _
Filter:=strFilter, FilterIndex:=3, Flags:=lngFlags, _
DialogTitle:="Choose the Compressed Image File")
If Len(strPathAndFile) > 0 Then
' MsgBox "You selected: " & strPathAndFile
Me![doc].Picture = strPathAndFile
Else
MsgBox "You didn't select a file", vbExclamation, "Images not copied"
Cancel = True
End If
' Since you passed in a variable for lngFlags,
' the function places the output flags value in the variable.
Exit_Sub:
Exit Sub
ErrHandler:
MsgBox "Error " & Err.Number & " : " & Err.Description & " in
Form_Open", vbExclamation, "Images in Access Example"
Cancel = True
Resume Exit_Sub
End Sub
appears. The user finds the file he wants to attach and clicks open.
I need that file to be saved to an Object field on the form (doc) but I get
the error 438:Object doesn't support this property or method in Form_Open.
How can I attach this file????????
Private Sub CommFind_Click()
' Purpose : Invokes the Windows Common Dialog GetOpenFileName function to
allow user to choose an image file
' Created/Modified : 8/15/07 By Dan Frisch,
On Error GoTo ErrHandler
Dim lngFlags As Long
Dim strFilter As String
strFilter = ahtAddFilterItem(strFilter, "Compressed Image Files (*.jpg,
*.jff, *.gif, *.tiff )", _
"*.JPG;*.JFF,*.GIF,*.TIF")
' strFilter = ahtAddFilterItem(strFilter, "dBASE Files (*.dbf)",
"*.DBF")
' strFilter = ahtAddFilterItem(strFilter, "Text Files (*.txt)",
"*.TXT")
strFilter = ahtAddFilterItem(strFilter, "All Files (*.*)", "*.*")
strPathAndFile = ahtCommonFileOpenSave(InitialDir:="C:\", _
Filter:=strFilter, FilterIndex:=3, Flags:=lngFlags, _
DialogTitle:="Choose the Compressed Image File")
If Len(strPathAndFile) > 0 Then
' MsgBox "You selected: " & strPathAndFile
Me![doc].Picture = strPathAndFile
Else
MsgBox "You didn't select a file", vbExclamation, "Images not copied"
Cancel = True
End If
' Since you passed in a variable for lngFlags,
' the function places the output flags value in the variable.
Exit_Sub:
Exit Sub
ErrHandler:
MsgBox "Error " & Err.Number & " : " & Err.Description & " in
Form_Open", vbExclamation, "Images in Access Example"
Cancel = True
Resume Exit_Sub
End Sub