Open another form showing same filtered records

B

bhammer

A2k

A subform is filtered by the user to show only the desired records. The user
then clicks a command button that opens another form containing a listbox
that reflects the same filtered records.

I have a recordet clone that shows the correct rs.recordcount in a textbox,
but O can't get the listbox to show the correct list of records.

-Brad
 
G

Guest

Try this:
In the command button get the filter string from the subform
strFilterString = Me.Filter
Then
DoCmd.OpenForm "frm", _
DataMode:=acFormReadOnly, _
WindowMode:=acWindowNormal, _
OpenArgs:=strFilterString
In the new form onLoad event

If Not IsNull(Me.OpenArgs) Then
strSQL = "SELECT whatever WHERE " & Me.OpenArgs
End If
The filter string from the calling form can be used for the where clause in
the new form. Create a recordset from strSQL and set the ListBox to that or
better, use AddItem in a subroutine for Office 2002+ or a Callback in Office
2000.
 

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