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
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