title: How to get the properties of the current active form from a class module?
body: <p>I currently have 2 forms that contains a <code>List Box</code> of records with some <code>Text Box</code> to allow user input. I have a <code>Command Button</code> that inserts the data input into a table, then I requery the <code>List Box</code> which is <strong>bounded</strong> to the table get the updated data.</p>
  
  <p>The functionality code in both forms are the same so I like to reduce as much repetitive code as possible and am basically trying to do something like this issue: </p>
  
  <p><a href="https://stackoverflow.com/questions/22848814/how-to-get-instance-of-actual-form-from-ms-access-in-a-module-vba">How to get instance of actual form from MS Access in a Module (VBA)</a></p>
  
  <p>I have created a class module to try and take the data input in the <code>Text Box</code> from the currently active form and store the value of each <code>Text Box</code> in each property of the class, then reference that in my form's <code>On Click</code> save command.</p>
  
  <pre><code>Option Explicit
  
  Public number As String
  Public name As String
  
  Public Function getData()
  
      Dim frmCurrentForm As Form
      Dim frmName As String
  
      Set frmCurrentForm = Screen.ActiveForm
      frmName = frmCurrentForm.Name
  
  End Function
  </code></pre>
  
  <p>I am able to get the current active form's name, but am unsure where to go from here to get the form's <code>Text Box</code> property data input, which as an example, are named <code>textBox_Number</code> and <code>textBox_Name</code>?</p>
  
  <p>The answer for the above issue states to do the following:</p>
  
  <pre><code>Public Sub mFormLoad(p_form As Form)
      'do stuff with p_form
  end sub
  </code></pre>
  
  <p>But using the <code>p_form</code> object to access its property, I can only find the generic properties of a <code>Form</code>, and not specific properties tied to my active form, i.e. <code>textBox_Number</code> and <code>textBox_Name</code>.</p>
  
  <p>Being new to VBA programming, can someone guide me through?</p>
  
  <p>Thanks!</p>