title: Filtering a subform in Microsoft Access using an unbound textbox in main form
body: <p>I have two forms: "<strong>Job Sheet</strong>" (the main form) and "<strong>Jobs sub</strong>" (the subform).</p>
  
  <p>I'm trying to use the '<em>afterupdate</em>' function with an unbound textbox called <strong>yrcheck</strong> to filter the datasheet view of the subform, by the <strong>JbYr</strong> field. </p>
  
  <p>Please tell me, what's wrong with this code? </p>
  
  <pre><code>Private Sub yrcheck_AfterUpdate()
  
  Dim yr As Integer
  yr = Me.yrcheck
  [Jobs sub].Form.Filter "JbYr='" &amp; yr &amp; "'"
  [Jobs sub].Form.FilterOn = True
  
  End Sub
  </code></pre>
  
  <p>I get "Invalid Use of Property" as an error.</p>
  
  <p>What's wrong?</p>