title: How to use DLookup In an Update Query
body: <p>I have two tables: "PartNumberX" and "MasterPartTable". My end goal is to extract certain fields out of the "MasterPartTable" using queries to get a list of unique part numbers ("MasterPartTable" has duplicates). I was able to successfully get all the fields out that I wanted except for one using the <code>SELECT DISTINCT</code> method. The last column, "Part Name" unfortunately is sloppily created (by someone else) and some part names have a comma where an identical part number may not eg. "Assembly, The Thing" and "Assembly The Thing" both have the same part number so I only want one of them. My idea was that I would be able to insert the good data into a table and then run an update query that uses a <code>DLookup</code> to look up the part name using the part number in "PartNumberX" to look up the corresponding part name from "MasterPartTable" but I can't seem to get it to work.</p>
  
  <p>When I use the update query below, it returns the same number of blank fields as there are in "PartNumberX".</p>
  
  <pre><code> UPDATE PartNumberX 
   SET PartNumberX.[Part Name] = DLookUp("[MasterPartTable].[Part_Name]","MasterPartTable","MasterPartTable.Part_Number = PartNumberX.Part_Number");
  </code></pre>
  
  <p>Am I missing something here or is there a different way to do this? I know that I could use VBA and scroll through each field individually to do this but I would prefer a much faster query.</p>
  
  <p>Edit-</p>
  
  <p>Using the second method from HansUp I got the following:</p>
  
  <p><code>UPDATE MasterpartsTable INNER JOIN PartNumberX ON MasterpartsTable.Part_Number=</code>
  <code>PartNumberX.Part_Number</code>
  <code>SET PartNumberX.[Part Name] = [MasterpartsTable].[Part_Name];</code></p>
  
  <p>Which results in an empty query.</p>
  
  <p>Edit2-</p>
  
  <p>I actually just ran the darn thing and it worked perfectly! I don't understand why the preview comes up empty, but regardless it works.</p>