Question

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.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top