title: Why can't I get the current record ID from a multi-instance form in VBA
body: <p>I have a database I'm working on with a number of forms, some of them have to be updated when something in a different form is changed. I've set it up so that they're multi-instance forms, which works something like this:</p>
  <pre><code>Set frm = New Form_Name
  frm.RecordSource = &quot;select * from Table_Name where id = &quot; &amp; ID
  colForms.Add Item:=frm, Key:=frm.hwnd &amp; &quot;&quot;
  mintForm = mintForm + 1
  frm.SetFocus
  frm.Visible = True
  </code></pre>
  <p>colForms is a collection.
  To refresh a form, I've added a function that refreshes the form that matches the name and ID passed:</p>
  <pre><code>Function RefreshForm(RForm As String, ID As Integer)
      If Developer = False Then On Error GoTo Fehler
      Dim F As Form
      On Error Resume Next
      For i = 1 To mintForm
          Set F = colForms(i)
          If F.CurrentRecord = ID And F.Name = RForm Then F.Refresh
      Next i
  'Error handling logic
  Done:
      Exit Function
  Fehler:
      RuntimeError &quot;MultiInstance: RefreshForm&quot;, Err.Number, Err.Source, Err.Description, Err.HelpFile, Err.HelpContext, Err.LastDllError
      Err.Raise 1000, , &quot;Folgefehler&quot;
  End Function
  </code></pre>
  <p>Problem is, F.CurrentRecord is always 1 for some reason, even though the ID of the record in the form is definitely not 1. Any idea what I'm doing wrong, or how I could properly get the record ID (primary key) from the form? The form is definitely bound (at least the ones where I'm trying to get the ID).</p>