Display and ole object in a message box (1 Viewer)

shaneucc

Registered User.
Local time
Today, 00:31
Joined
Jul 25, 2013
Messages
28
I'm trying to display an image which is saved in the table as an OLE Object in a message box. The field with the object is "PowerCurve". This is what I'm trying to do. It allows me to get as far as clicking yes to view the second message box but then it results in an error when it tries to display the image. Any ideas?

Code:
Dim strDetails As String
    strDetails = DLookup("Details", "ExistingDeviceDetailsQ")
    Dim strCurve As String
    strCurve = DLookup("PCurve", "DeviceT", "DeveloperProduct = '" & Forms!DeviceF!D_ExistingDeviceCmb & "'")
    
    If strCurve = "No" Then
        MsgBox strDetails, , "Device Details"
    Else
        Dim DeviceDetails As Integer
        DeviceDetails = MsgBox(strDetails & vbCrLf & " " & vbCrLf & "Do you wish to view device power curve/matrix?", vbYesNo, "Device Details")
    
        Dim image As Object
        image = DLookup("PowerCurve", "DeviceT", "DeveloperProduct = '" & Forms!DeviceF!D_ExistingDeviceCmb & "'")
        
        If DeviceDetails = vbYes Then
            MsgBox image
        Else
        End If
        
    End If

I get the error "Object variable or With block variable not set" on the line

image = DLookup("PowerCurve", "DeviceT", "DeveloperProduct = '" & Forms!DeviceF!D_ExistingDeviceCmb & "'")
 

Trevor G

Registered User.
Local time
Today, 00:31
Joined
Oct 1, 2009
Messages
2,341
As far as I am aware you can't display an image in a msgbox, the way around it is to create Forms and size them and position them.
 

shaneucc

Registered User.
Local time
Today, 00:31
Joined
Jul 25, 2013
Messages
28
Thanks. I was afraid of that.
 

Users who are viewing this thread

Top Bottom