Hi All, Hope all is well. Im trying to add an object selected from a dialog box into an attachment box on a form with the intention of then saving the object to the attachment field in the table. Ive read this isnt the thing to do, but im trying it for two purposes (1) I don't trust the few users to put an object in a common folder and not overwrite the object name eg an image titled image1 into a folder and overwriting one that is already there..and (2) its not as straight forward as a thought and hopefully learn something.
My first problem is i have a test form with an attachment box on it called a2. I'm trying to insert an object with the code below and getting the error runtime error 438 object doesn't support this property or method no matter what object i try eg .xls , .png . I ve used attachments before when they were bound and it was just a matter of clicking on the paper clip and adding. please see the code any pointers gratefully received
My first problem is i have a test form with an attachment box on it called a2. I'm trying to insert an object with the code below and getting the error runtime error 438 object doesn't support this property or method no matter what object i try eg .xls , .png . I ve used attachments before when they were bound and it was just a matter of clicking on the paper clip and adding. please see the code any pointers gratefully received
Code:
Set f = Application.FileDialog(1)
f.AllowMultiSelect = False
If f.Show Then
For Each varitem In f.SelectedItems
strFile = Dir(varitem)
MsgBox strFile 'checks the object name
strfolder = Left(varitem, Len(varitem) - Len(strFile))
MsgBox "Folder" & strfolder & vbCrLf ' checks the path
Me.a2 = strfolder + strFile
Next
End If
Set f = Nothing