Filtering subforms

G

gtslabs

I have a from and Subform linked with a field called "labsampleid".
Both main and sub forms are continious.
I am trying to filter what I can put in the sub form based on the
value in a field of the current selected record in the main form.
However I dont think my SQL is correct.

Here is the code in my subform for the field I want to filter.

SELECT [tbl-TestCodes].TestCode, [tbl-TestCodes].TestName, [tbl-
TestCodes].Matrix, [tbl-TestCodes].SortOrder
FROM [tbl-TestCodes]
WHERE ((([tbl-TestCodes].Matrix)=[Forms]![F_Samples Management]!
[Matrix]))
ORDER BY [tbl-TestCodes].SortOrder;

The WHERE does not know what record I have selected above in the
F_Samples Management form.
I want to filter the subform record based on the value in the MATRIX
field for the selected record in the F Samples Management form.
 
A

Allen Browne

A subform is one that appears on another form, in a subform control. A form
in continuous view cannot have a subform. There is a high chance that we
will not understand what you are asking here.

If these are 2 separate forms (not a form and subform), you will need to
Requery the other form whenever the value in the first form changes, or it
won't match.
 

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