title: Set DefaultValue in Access form to last record of a table
body: <p>I have an Access form with a text box named Box1.</p>
  <p>In this text box, I want to have the <strong>name</strong> of the last product in my table <strong>Products</strong> as the default value.</p>
  <p>My table product has the fields: <em>P_ID</em> and <em>P_Name</em>.</p>
  <p>I have coded in VBA in the form:</p>
  <pre><code>Me!Box1.DefaultValue = DLookup(&quot;P_Name&quot;, &quot;Products&quot;, &quot;P_ID = DMax(&quot;P_ID&quot;, &quot;Products&quot;)&quot;)
  </code></pre>
  <p>However, there is an error in my code as the textbox displays <em>#Name</em>.</p>