Sub form filter problem : please !

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi,
In my mainForm a have a subForm (continues form) where user can filtering the data from a combo box on a mainForm, using LinkChildFields and LinkMasterFields properties it works fine, but now I want to add a buttton to Removed the filter so the subForm will show all records.

I tried to set the LinkChildFields and LinkMasterFields properties but it didn't work.

Can someone please help me, thanks
 
Gabriel, What I might do is design another subform identical to the subform
you have. Name it subForm2. Drag it to your mainForm like you did the
original subForm and place/size it directly over the existing subForm. Make
sure the LinkChildFields and LinkMasterFields properties are not set for
this subForm2 and set the visible property to False of subForm2. Now place 2
command buttons on you main form. One called maybe cmdAllRecords and the
other cmdLinkedRecords. Size them the same and place one directly over the
other. Set the visible property of cmdLinkedRecords to False. Now add the
following code to the Click event of your command buttons.


Private Sub cmdAllRecords_Click()
Me.subForm.Visible = False
Me.subForm2.Visible = True
Me.cmdLinkedRecords.Visible = True
Me.cmdLinkedRecords.SetFocus
Me.cmdAllRecords.Visible = False
End Sub

Private Sub cmdLinkedRecords_Click()
Me.subForm.Visible = True
Me.subForm2.Visible = False
Me.cmdAllRecords.Visible = True
Me.cmdAllRecords.SetFocus
Me.cmdLinkedRecords.Visible = False
End Sub


--
Reggie

----------
Gabriel said:
Hi,
In my mainForm a have a subForm (continues form) where user can filtering
the data from a combo box on a mainForm, using LinkChildFields and
LinkMasterFields properties it works fine, but now I want to add a buttton
to Removed the filter so the subForm will show all records.
 
Back
Top