Filter by matching RefID in Subform

  • Thread starter Thread starter DeVille
  • Start date Start date
D

DeVille

Hi I am trying to filter records in my main form by
matching RefID in my sub form

I have a main form 'MainForm' with a sub form (SubForm'
in it, The MainForm gets its data from the 'MainTable'
and the sub form gets its data from the 'SubTable', both
tables are linked by a RefID field, However there are
some Records in the 'MainTable' with a RefID Number that
has no matching record 'SubTable', What I want to be able
to do is, from the 'MainForm' click a
button 'FilterButton' to apply a filter to show only
those records in the 'MainTable' that have a matching
RefID in the 'SubTable' Here is the code I have so far,
the (?) represents the place where I think I need the
missing code, if anyone has the solution thanks in
advance

Private Sub FilterButton_Click()
On Error GoTo Err_FilterButton_Click


Dim QryFld As String
Dim CurRecNo As String


Let CurRecNo = Form.CurrentRecord
QryFld = " RefID "

Me.Filter = (?)
Me.FilterOn = True

Exit_FilterButton_Click:
Exit Sub

Err_FilterButton_Click:
MsgBox Err.Description
Resume Exit_FilterButton_Click

End Sub
 
Back
Top