Help in filtering my subform

  • Thread starter mattc66 via AccessMonster.com
  • Start date
M

mattc66 via AccessMonster.com

I have a main form and subform. I have a check box (unbound) on my main form.
When the user checks this box I want it to only show records in the subform
that dont have a check in the "DONE" box. The blow IF shows the records that
have a check box if ckNotCkd is = -1 and all records show if the ckNotCkd is
= 0. The subform is based on a query and is a Datasheet form.

If Me.ckNotCkd = -1 Then
Me.frmICSTOCK.LinkMasterFields = "ckNotCkd"
Me.frmICSTOCK.LinkChildFields = "Done"
End If

If Me.ckNotCkd = 0 Then
Me.frmICSTOCK.LinkMasterFields = ""
Me.frmICSTOCK.LinkChildFields = ""
End If
 
J

Jeanette Cunningham

Hi matt66,
the link master fields and link child fields aren't meant to be used the way
you have shown below.

They are meant for a field that appears in both the main form and subform.
Usually it is the primary key of the main form's record source and the
foreign key of the subform's record source. It is the field that links the
subform to the main form.

To filter means to use a where clause that shows only the records that match
the filter.

There is a great sample database that shows how to use filters based on user
choices here
http://allenbrowne.com/ser-62.html

Use it to see how to build a filter using a where clause and apply that
logic to your main form and subform setup.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top