title: Pass a selected value to a second combo-box to filter available values
body: <p>I am creating a form in Access 2013 which would allow the user to select a previously entered record for which they want to enter additional, related data. The underlying table has thousands of records so I want to use two combo boxes to make selection easier. According to multiple posts I’ve found elsewhere I should be able to set the Row Source of the cboGetSite combo-box to a table that lists all available sites. I then set the AfterUpdate() event to use the selected site to filter the second combo-box to a list that includes the available visits to that site with something like:</p>
  
  <pre><code>Private Sub cboGetSite_AfterUpdate()
      Me.cboGetDate.RowSource = “SELECT VisDate FROM” &amp; _
                      “qrySiteVisits WHERE location =” &amp; _
                      Me.cboGetSite &amp; _
                      “ORDER BY VisDate”
  End Sub
  </code></pre>
  
  <p>When I then select a value in the cboGetSite combo-box, I get an error that states, </p>
  
  <p>“The expression After Update you entered as the event property setting produced the following error: Invalid outside procedure. *The expression may not result in the name of a macro, the name of a user-defined function, or [Event Procedure]. *There may have been an error evaluating the function, event, or macro.”</p>
  
  <p>Can anyone suggest where I may be going wrong? I do not use VBA, so this is a stretch for me. I’m following guides found in several threads online. Please don’t respond with, “Well the error obviously tells you…” If it were obvious I wouldn’t be asking. </p>
  
  <p>Can someone just walk me through the steps? Given a query that lists the available sites and dates of visits I need to:</p>
  
  <ol>
  <li>Select a site from a combo-box thus setting a cboGetSite value </li>
  <li>Pass cboGetSite to cboGetDate combo-box, thus filtering to a set of visit dates.</li>
  <li>Select a date which sets a tempVar (with SetTempVar()) which is then set as the value in subsequent forms to add related data to one of several tables, linking it back to the correct Visit record via the cboGetDate variable. </li>
  </ol>