开发者

Filter a form using a command button on another form

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.Op开发者_如何学CenForm 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.


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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜