Hi.
How do you set a list box's rowsource to reflect the recordset of its form,
even when the recordset it filtered?
Did the code suggested to you not work the last time you asked this question?
http://groups.google.com/group/micr...public.access.*&rnum=1&hl=en#1db0f25fa676247d
Paste the code below into your form's code module, then replace the following:
1.) ChgRowSrcBtn with the name of your button;
2.) lstList with the name of your list box.
Then save the form's code module and compile the code.
Private Sub ChgRowSrcBtn_Click()
On Error GoTo ErrHandler
If (Len(Me.Filter) > 0) Then
Me!lstList.RowSource = "SELECT * " & _
"FROM " & Me.RecordSource & _
" WHERE " & Me.Filter
Else
Me!lstList.RowSource = Me.RecordSource
End If
Me!lstList.Requery
Exit Sub
ErrHandler:
MsgBox "Error in ChgRowSrcBtn_Click( )." & vbCrLf & vbCrLf & _
"Error #" & Err.Number & vbCrLf & vbCrLf & Err.Description
Err.Clear
End Sub
HTH.
Gunny
See
http://www.QBuilt.com for all your database needs.
See
http://www.Access.QBuilt.com for Microsoft Access tips.
(Please remove ZERO_SPAM from my reply E-mail address so that a message will
be forwarded to me.)
- - -
If my answer has helped you, please sign in and answer yes to the question
"Did this post answer your question?" at the bottom of the message, which
adds your question and the answers to the database of answers. Remember that
questions answered the quickest are often from those who have a history of
rewarding the contributors who have taken the time to answer questions
correctly.