Full Version: Filter unbound control
UtterAccess Forums > Microsoft® Access > Access Forms
I have an unbound combo box that I am using to allow users to select current name data. I have the control working but I need it to filter for a nametype. I have the FKIDnametype in my row source. Here is my current After Update code
Private Sub Combo40_AfterUpdate()
    ' Find the record that matches the control.
        Me.RecordsetClone.FindFirst "[IDname] = " & Me![Combo40]
        Me.Bookmark = Me.RecordsetClone.Bookmark
End Sub

That and where do I add filter code?
I'm not sure I understand.
If you are saying you want to only show records in the list that meet a certain Name Type, you need to set that in the row source of the combo box prior to it being used. Do you have another combo box or control to select the name type? If you do a search on Cascading Combo Boxes you should get lots of examples of how to do this.
Yes I need to only show records that meet the FKIDnametype = 3. I do not have another combo box. I am needing to select the name type within the existing combo box. I can not filter through the query since that query is being used for other IDnametypes (4, 6, 8, 12, etc.). My row source currently looks like this:
SELECT qryname.IDname, qryname.MainName, qryname.FKIDnametype FROM qryname;

Would I say FKIDnametype = 3 within the row source?
Yes, change the rowsource as follows:
SELECT qryname.IDname, qryname.MainName, qryname.FKIDnametype FROM qryname WHERE FKIDnametype=3 ;
Thanks for the info. I fogot about the WHERE clause. Still new and still learning. Thanks goodness for UA.
No worries. Glad I could help.
Good luck with your project.
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.