title: Is there a way to include recordset update in the same record as the rest of a form?
body: <p>I'm using a form to fill out a record in a table with multiple different fields. I am also using the form to create a folder that will hold copied files from another folder of the users choice. One of the fields is the filename of whichever files the user would like to copy. I am trying to add this information to a cell that is in the same record as the rest of the information I'm entering on the form. However, whenever I use the <code>rs.AddNew</code> method, it just adds the information I input into a cell in a new record, instead of the same one with the rest of the information I'm inputting on the form. I've tried using the <code>rs.Edit</code> method, but that only works if I go back to the previous record and input the information again. Is there a way to add the filename into the cell in the same record as the rest of the information I'm putting in?</p>
  <p>Here is my script for this portion. The issue is in the last three lines of the final If statement.</p>
  <pre><code>'NOTE: To use this code, you must reference
  'The Microsoft Office 14.0 (or current version)
  'Object Library by clicking menu Tools&gt;References
  'Check the box for:
  'Microsoft Office 14.0 Object Library in Access 2010
  'Microsoft Office 15.0 Object Library in Access 2013
  'Click OK
  'http://analystcave.com/vba-application-filedialog-select-file/
  '20171117
  MsgBox &quot;Select files you would like to copy to the &quot; &amp; DateTimeID.Value &amp; &quot; folder.&quot;
  
  
      Dim fd As FileDialog, result As Integer
      Dim db As DAO.database
      Dim rs As DAO.Recordset
      Dim stFileName As String
      
      
      
      Const msoFileDialogOpen As Long = 3
      Const msoFileDialogViewDetails As Long = 2
      
      Set fd = Application.FileDialog(msoFileDialogFilePicker)
      Set db = CurrentDb
      Set rs = db.OpenRecordset(&quot;tblFieldLogAUTOID&quot;, dbOpenTable)
      
      With fd
          .AllowMultiSelect = True
      'Optional FileDialog properties
          .Title = &quot;Select a file&quot;
          .InitialFileName = &quot;C:\&quot; 'We can start the file search at a certain point if data starts in the same directory across all computers
      'Optional: Add filters
          .Filters.Clear
          .Filters.Add &quot;Excel files&quot;, &quot;*.xlsx&quot; 'We can filter for the type of data files coming from the field to make it easier
          .Filters.Add &quot;All files&quot;, &quot;*.*&quot;
      'Show the dialog. -1 means success!
          If .Show = -1 Then
              For Each it In .SelectedItems
                  Debug.Print it
                  stFileName = it
                  FileCopy stFileName, NewLocation &amp; &quot;\&quot; &amp; FileNameWithExt(stFileName)
                  rs.AddNew
                  rs!FileName = NewLocation &amp; &quot;\&quot; &amp; FileNameWithExt(stFileName)
                  rs.Update
                  
              Next it
          End If
      End With
  End Sub
  </code></pre>
  <p>For an idea of what it's doing with the <code>rs.AddNew</code> method, here is an image with one record having the data I input from the form in one row, and another record with the filename in a cell on the next row.</p>
  <p><a href="https://i.stack.imgur.com/yDlUe.png" rel="nofollow noreferrer">enter image description here</a></p>