title: Creating Recordset with SQL statement
body: <p>I am trying to create a recordset in Access VBA that will show me all records in a table related to the current record of a form.  My current code looks like this:</p>
  
  <pre><code>Private Sub Form_Load()
  
      Dim rst As Recordset
  
      Set rst = CurrentDb.OpenRecordset("Select [ID], [Ln] From [Order Detail] Where ((([Order Detail].[ID]) = [Forms]![Order Data Entry Header]![ID]))")
  
      rst.MoveLast
      Forms![Order Data Entry Header].LineNum = rst![Ln]
  
  End Sub
  </code></pre>
  
  <p>I am doing this so that when adding new records they can be numbered sequentially after the highest number.  When I run the form it get "Run-time Error: '3061'  Too few parameters. Expected 1." on the Set rst line.</p>
  
  <p>Any help would be appreciated.</p>