Application-defined or object-defined error on a subform within a subform (1 Viewer)

Pooks_35

Registered User.
Local time
Yesterday, 23:30
Joined
Mar 14, 2013
Messages
54
I have been fighting with this code all day with numerous error messages and not fix. I find a lot of previous questions, but non that really help me. I have a Navigation Form and I have a subform with a subform in it. The code for the control button to add a photo is below. The latest message I get is "Application-defined or object-defined error." I'm at my wits end with this as I've fought with this code all day. If anyone can help, I would REALLY appreciate it!:banghead:

Public Sub cmdInsertPic_Click()
Dim OFN As OPENFILENAME
On Error GoTo Err_cmdInsertPic_Click

' Set options for dialog box.
With OFN
.lpstrTitle = "Images"
If Not IsNull([PicFile]) Then .lpstrFile = [PicFile]
.flags = &H1804 ' OFN_FileMustExist + OFN_PathMustExist + OFN_HideReadOnly
.lpstrFilter = MakeFilterString("Image files (*.bmp;*.gif;*.jpg;*.wmf)", "*.bmp;*.gif;*.jpg;*.wmf", _
"All files (*.*)", "*.*")
End With

If OpenDialog(OFN) Then
[PicFile] = OFN.lpstrFile
Forms!CampInventory.frmPicExample.Form.cmdInsertPic!picsubform![imgPicture].Picture = [PicFile]
SysCmd acSysCmdSetStatus, "Afbeelding: '" & [PicFile] & "'."
End If
Exit Sub

Err_cmdInsertPic_Click:
MsgBox Err.Description, vbExclamation
End Sub
 

Galaxiom

Super Moderator
Staff member
Local time
Today, 16:30
Joined
Jan 20, 2009
Messages
12,854
Disable the On Error line so that you will be offered the debug/End dialog when errors occur. Then you can determine which line throws the error.
 

Users who are viewing this thread

Top Bottom