Form Filter Based on a Value in a Subform

D

DevDaniel

Good day,

I have: A continuous subform; each record has a unique field, some locked
fields, some unlocked fields, and a "Details" button.

I want: When the user clicks the "Details" button, a form opens. The form
will only display records based on the unique field.

Any suggestions?
 
S

Steve Schapel

DevDaniel,

There are several ways to approach this.

One is to use the Where Condition argument of the OpenForm method to
specify the record for the Details for to open at. For example...
DoCmd.OpenForm "Details", , , "[UniqueField]=" & Me.UniqueField

Another is to use a query for the Record Source of the Details form, and
in the Criteria of the UniqueField column, enter a reference to the
form's control, possibly something like this...
[Forms]![NameOfForm]![NameOfSubform]![UniqueField]
 
D

DevDaniel

It worked! Thanks for the help, Steve!

Steve Schapel said:
DevDaniel,

There are several ways to approach this.

One is to use the Where Condition argument of the OpenForm method to
specify the record for the Details for to open at. For example...
DoCmd.OpenForm "Details", , , "[UniqueField]=" & Me.UniqueField

Another is to use a query for the Record Source of the Details form, and
in the Criteria of the UniqueField column, enter a reference to the
form's control, possibly something like this...
[Forms]![NameOfForm]![NameOfSubform]![UniqueField]

--
Steve Schapel, Microsoft Access MVP

Good day,

I have: A continuous subform; each record has a unique field, some locked
fields, some unlocked fields, and a "Details" button.

I want: When the user clicks the "Details" button, a form opens. The form
will only display records based on the unique field.

Any suggestions?
 
Top