title: Pass parameters from one form to another and add new records
body: <p>I want:</p>
  
  <p>To be able to open a form, select an item from a control box, click a button to open a new form and be able to input new records that have the previously selected item added to their fields.</p>
  
  <p>What I have done so far:</p>
  
  <p>I have made two forms, added the controls in both, added a command button.
  I have used MS Access wizard to add this code:</p>
  
  <pre><code>Private Sub CommandNext_Click()
    On Error GoTo Err_CommandNext_Click
  
      Dim stDocName As String
      Dim stLinkCriteria As String
  
      stDocName = "FormX"
      DoCmd.OpenForm stDocName, , , "[BatchID] = " &amp; Me![ListBatch], acFormAdd
  
    Exit_CommandNext_Click:
  
      Exit Sub
  
    Err_CommandNext_Click:
  
      MsgBox Err.Description
      Resume Exit_CommandNext_Click
  
  End Sub
  </code></pre>
  
  <p>The third line is mine.</p>
  
  <p>As a result:</p>
  
  <ul>
  <li>If the second form <strong>isn't</strong> already open, pressing the button on the first form will open the second one with empty data (the text field that should show the value of the parameter is empty).</li>
  <li>If the second form <strong>is</strong> already open, pressing the button on the first form will change focus to the second one and it will show an old, existing record that matches the parameter I selected</li>
  <li>I want to open the second form without any old records showing but with the selected parameter appearing in the designated text field.</li>
  </ul>
  
  <p>In both cases in the second form the <em>Filter</em> property gets populated with the parameter I've sent using the button, but that isn't what I am aiming for.</p>