title: Invalid reference to Form property of subform (ms Access 2007)
body: <p>I'm using a technique similar to that in Remou's answer to <a href="https://stackoverflow.com/questions/3344649/how-to-loop-through-all-controls-in-a-form-including-controls-in-a-subform-acc">this question</a> to manipulate the propeties of the controls on a subform. Works great <em>as long as the parent form's recordset has at least one record</em>. If the parent form has no records, I get:</p>
  
  <p>Error 2455, "You entered an expression that has an invalid reference to the property Form/Report."</p>
  
  <p>The error is thrown when I attempt the recursive call. A simplified version of the code is below (I've stripped out error handling &amp; a couple more Cases, including an Else). This code lives in a Module and is called from the Load event of most forms in my application:</p>
  
  <pre><code>Public Sub LockUnlockForm(frmLoad As Form)
  
  Dim ctl As Control
  
      For Each ctl In frmLoad.Controls
          With ctl
              Select Case .ControlType
                  Case acTextBox, acComboBox, acCheckBox
                      .Locked = Not gblnAuthorized
                  Case acSubform
                      LockUnlockForm .Form  '&lt;--- this line errors
              End Select
          End With
      Next
  
  End Sub
  </code></pre>
  
  <p>What I want to do on the form that's giving me the problem right now is to create a new record at the parent level and allow the user to add data to the subform (if <code>gblnAuthorized</code> is True, or set a simple message if it's False). Do I have no choice but to do that before calling <code>LockUnlockForm</code>? Will creating a new parent-form-level record even work to prevent this error?</p>