title: Make field start at 1 and increment by 1 for every new field value in an MS-Access 2013 form?
body: <p><strong>Update:</strong><br>
  I got it working. Here is the code I used to do this:</p>
  
  <pre><code>Private Sub Amount_GotFocus()
  
  If Not IsNull(DLookup("[Line#]", "[t_Line#]", "[PO#] = [PO#].Value")) Then
      [CustPOLine#].Value = DMax("[CustPOLine#]", "t_CUST_PO_LineItems", "[CustPO#] = [CustPO#].Value") + 1
  Else
      [CustPOLine#].Value = 1
  End If
  
  End Sub
  </code></pre>
  
  <p>I use DLookup to check if there are any values in the table with the same PO# as the one in the form's textbox. If it returns null, I set the value of Line# to 1. If it is not null, I use the DMax function to get the highest value for Line# where the PO# is equal to the one entered in the form.</p>