Edit Attachments from Form

michal79

Registered User.
Local time
Today, 17:47
Joined
Nov 27, 2012
Messages
14
Hi,

I need some help with the following, hope it's doable.
I have a form which I use to add / edit records in my db, both within a navigation form. The subform lists all 'not-yet-approved' records. I can 'call' a record from my subform by clicking on it and then clicking on an Edit button on my form which will then transfer all data to the form and allow me to update any field and update the record. Below is the code for my Edit button. In my table I have an Attachmants field. I can no problem add files/attachments to my table using the form I created but I don't know how to 'call' the attachments so that I can edit them e.g. add new files, delete etc.

At the moment I get a Run-time error '32652:
Item not found in this collection.

My guess is that I'm not referencing the attachment 'field' correctly, I don't even know if it's possible to 'call it' ... as the Attachents are stored as FileData, FileType etc...

I attach a picture of the form setup.

Code:
Private Sub Editbutton_Click()
'check whether there exists data in list
    If Not (Me.LPQsubform.Form.Recordset.EOF And Me.LPQsubform.Form.Recordset.BOF) Then
        'get data to text box control
        With Me.LPQsubform.Form.Recordset
 
            'set LessonID ControlSource to ""
            Me.TxDEID.ControlSource = ""
 
            Me.TxDEID = .Fields("LessonID")
            Me.TxDELTitle = .Fields("Lesson Title")
            Me.CbDEPhase = .Fields("Phase")
            Me.CbDEStage = .Fields("Stage")
            Me.YNDEKeyLL = .Fields("KeyLL")
            Me.CbDEApprove = .Fields("Approvedby")
            Me.CbDEWellName = .Fields("Well Name")
            Me.CbDEFieldName = .Fields("Field Name")
            Me.CbDERigName = .Fields("Rig Name")
            Me.CbDESection = .Fields("Section")
            Me.CbDEActivity = .Fields("Activity")
            Me.CbDEVendor = .Fields("Vendor")
            Me.TxDEDate = .Fields("LLDate")
            Me.CbDEOrigIni = .Fields("Originator Initials")
            Me.CbDEDept = .Fields("Department")
            Me.CbDEStatus = .Fields("Status")
            Me.TxDEDescr = .Fields("Description")
            Me.TxDELearnings = .Fields("Learning Points")
            [COLOR=red]Me.icoAttachments = .Fields("Attachments")[/COLOR]
            
            'store id of LLIS in Tag of TxDEID in case id is modified
            Me.TxDEID.Tag = .Fields("LessonID")
            'hide Add button and show Update button
            Me.AddRecord.Visible = False
            Me.UpdateRecord.Visible = True
            'disable button edit
            Me.Editbutton.Enabled = False
        End With
    End If
End Sub

I'll appreciate any suggestions. Thanks!
 

Attachments

  • Form.jpg
    Form.jpg
    89.6 KB · Views: 112

Users who are viewing this thread

Back
Top Bottom