title: Add attachment via VBA in MS Access
body: <p>One of my form is as follows</p>
  
  <p><img src="https://i.stack.imgur.com/25JPM.png" alt="enter image description here"></p>
  
  <p>It is a form made in MS Access which allows my users to add observations. An observation may include attachments as shown. I am able to click on attachment control and Add attachments to the popup that pops up. However, what is expected is that when I click ADD button as shown in the form above, this attachments shall be added to the corresponding field of a table. </p>
  
  <p>All controls on this form are unbound. </p>
  
  <p>The code written behind ADD button is as follows:</p>
  
  <pre><code>Private Sub cmdAdd_Click()
      Dim db As DAO.Database
      Dim rs As DAO.Recordset
  
      Set db = CurrentDb
      Set rs = db.OpenRecordset("tblObservation", dbOpenDynaset)
  
      rs.AddNew
  
      rs![Artifact] = artifactId
      rs![Observation Text] = txtObservationText.Value
  
      'rs![Attachments] = ' not able to solve this
  
      rs.Update
      rs.Close
  
      Set rs = Nothing
      Set db = Nothing
  End Sub
  </code></pre>