title: Access Expression/VBA for Matching Entry with Table
body: <p>I am not very good at VBA in access. I have what I think should be a reasonably simple task: when a zip code is entered in a combo box, I would like to verify that the County (on the same table with Zip codes) of that zip is the same as the county entered in an earlier part of the form - or, if no county was entered, for the zip to populate that field with a County.</p>
  
  <p>In other words, I don't want to simply populate a given field when data is entered into another, but to verify the data entered in two separate fields are consistent with two columns in a table (and then to act accordingly).</p>
  
  <p>I have a County combo box which is related to a table with a list of counties; then I have a zip combo box which is related to a table with Zip Code, Town, County (3 columns).</p>
  
  <p>I hope this makes sense; thanks very much for any help..</p>
  
  <p>Here is my meager attempt:</p>
  
  <pre><code>Private Sub zip_AfterUpdate()
  If Me![County] &lt;&gt; Me![Zip].Column(2) Then 
  MsgBox "County selected does not match zip code."
  End Sub
  </code></pre>