File Open Common Dialog

  • Thread starter Thread starter GR
  • Start date Start date
G

GR

Hi,
I have a form called Devices which holds the description
of different devices including a pic of the device.
I want to add a button which lets the user browse for the
image in his current folder so the pic can be changed or
added if there's no image associated to the current device.

I'am trying with the following code

Private Sub cmdOpen_Click()
Dim dlgCommon As CommonDialog
Dim olePicture As ObjectFrame

dlgCommon.ShowOpen
If Len(dlgCommon.FileName) Then
olePicture.SourceDoc = dlgCommon.FileName
olePicture.Action = acOLECreateLink
End If
End Sub

But the following error message appears:
"Object Variable or With block variable not set"

All the necessary references are created.. I think is an
instantiation mistake but how to solve it?

thx
 
GR

I prefer to use the Window File/Save API call, it makes your project
smaller and comes with the advantage that it is not version specific.
Check out the reference at: http://www.mvps.org/access/api/api0001.htm

--
HTH

Dale Fye


Hi,
I have a form called Devices which holds the description
of different devices including a pic of the device.
I want to add a button which lets the user browse for the
image in his current folder so the pic can be changed or
added if there's no image associated to the current device.

I'am trying with the following code

Private Sub cmdOpen_Click()
Dim dlgCommon As CommonDialog
Dim olePicture As ObjectFrame

dlgCommon.ShowOpen
If Len(dlgCommon.FileName) Then
olePicture.SourceDoc = dlgCommon.FileName
olePicture.Action = acOLECreateLink
End If
End Sub

But the following error message appears:
"Object Variable or With block variable not set"

All the necessary references are created.. I think is an
instantiation mistake but how to solve it?

thx
 
Back
Top