title: Reference active table in split form without using actual table name
body: <p>I'm writing an Access database. I have a number of forms that are identical. These are used to edit look up lists for different fields in my main contacts table.</p>
  
  <p>e.g. there is a company field and a country field. The forms that open for each editable list are identical with repeat vba code in each becasue I cannot work out how to reference the active table from the active form.</p>
  
  <p>The code I currently have for clearing all the yes/no boxes in the table is:</p>
  
  <pre><code>Private Sub cmdClearTicks_Click()
  
      Dim db As Database
     ' Dim sel  As Control
  
      Set db = CurrentDb
      ' Clear all ticks of selected records
      db.Execute "UPDATE ContactCompany " _
          &amp; "SET Selected = null "
  
  
      ' Update Selected Field
     Me.Requery
  
  End Sub
  </code></pre>
  
  <p><code>ContactCompany</code> is the name of the table. I would like to be able to set this sub globally but cannot work out what I should replace <code>ContactCompany</code> with to reference the table in the currently open form. I've already tried <code>Me.RecordSource</code> which does not work.</p>
  
  <p>I'm very grateful for what I assume is a very easy fix!</p>
  
  <p>Sean posted a great fix below.  I'm now stumped with including a filter too and defining it globaly.</p>
  
  <pre><code>Sub SelectFiltered(RS As String)
  
  Dim strFilter As String
  Dim strSQl As String
  
  If InStr(RS, "FROM") Then
      RS = Mid(RS, InStr(RS, "FROM") + 5)
      If InStr(RS, " ") Then RS = Left(RS, InStr(RS, " ") - 1)
  End If
  
  strFilter = Me.Filter
  
  If Me.FilterOn = False Then
  
  'Select Case MsgBox("No search or filter applied.", vbCritical + vbOKOnly, "Warning")
  'End Select
  
  strSQl = "UPDATE " &amp; RS &amp; " " &amp; _
  "SET Selected = 1 "
  
  Else
  
  strSQl = "UPDATE " &amp; RS &amp; " " &amp; _
  "SET Selected = 1 " &amp; _
  "WHERE " &amp; strFilter
  
  End If
  
  DoCmd.SetWarnings False
  DoCmd.RunSQL strSQl
  DoCmd.SetWarnings True
  
  End Sub
  </code></pre>
  
  <p>Me.filter doesn't work in the global sub.  Sean - I'm sure you'll have an answer for this in a sec.  Thanks again!</p>