views:

42

answers:

1

I have a form with a cmdbutton that at the moment opens another form and shows all records for several types of PartitionStyles and TrimFinishs (486 at present), I need to be able to filter the second form to show only the TrimFinish I need.

Private Sub lbl600SeriesS_Click() Dim stDocName As String Dim stLinkCriteria As String

stDocName = "frmModules"
stLinkCriteria = "Forms!frmModules![TrimFinish] = 1"
DoCmd.OpenForm stDocName, , , stLinkCriteria

End Sub

At the moment it shows only a new record, I know there should be 162 records using 1, what have I missed or done incorrect.

+1  A: 

Base stLinkCriteria on a field in frmModules' RecordSource. So, if the RecordSource includes a numeric field named TrimFinish, try something like this:

stLinkCriteria = "[TrimFinish] = 1"

If the RecordSource is a query drawing from more than one table, you can qualify the field name with the table alias:

stLinkCriteria = "YourTableAlias.[TrimFinish] = 1"

If you still have trouble, edit your question to describe frmModules' RecordSource. If it's a query, paste in the SQL View of the query.

HansUp
Thanks, stLinkCriteria = "[TrimFinish] = 1" works.I have been asked if I can add another filter for PartitionStyle within the same section of code.
Shaun
@Shaun Filter for PartitionStyle instead of, or in addition to, filter for TrimFinish? Is PartitionStyle text or numeric data type?
HansUp
Shaun