Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Modules / DAO / VBA / September 2007

Tip: Looking for answers? Try searching our database.

Combo Box Form Filter

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
BWD - 29 Sep 2007 22:34 GMT
Spinning my wheels here....

I have one table with 1,000+ records and each record has a (required)
status; active or inactive.  These records are stored in one table
called customers.  I have a form that displays the customers and would
like to add a combo box to my form so that I can filter which records
are displayed.

The intended result would be a combo box that displays 2 values;
active and inactive.  When one of those values is selected from the
combo box the forms recordset would only contain records that have the
status chosen from the combo box.  For example, the user selects
"Active" from the cmbo box, only records with an active status are
available to scroll though on the form.

I have tried docmd.applyfilter and me.filter methods with results that
do not match what I am hoping for.  Do I need to write a
clonerecordset command into my VBA or...?

Thanks
Stuart McCall - 29 Sep 2007 22:48 GMT
> Spinning my wheels here....
>
[quoted text clipped - 16 lines]
>
> Thanks

If your status field is of type text, containing the words 'Active' or
'Inactive' then:

Me.Filter = "Status='Active'"
MeFilterOn = True

ought to do it (eg in the form's onload event). If however status actually
contains a number, then

Me.Filter = "Status = 1"
MeFilterOn = True

is the way to go.
BrerGoose - 29 Sep 2007 22:53 GMT
Use the onChange event of the combo and then set the RowSource.

Select Case strStatus
 Case "Active"
   Me!ctlStatus.RowSource = qryActiveStatus
 Case "Inactive"
   Me!ctlStatus.RowSource = qryInactiveStatus
End Select

BrerGoose
BrerGoose - 29 Sep 2007 23:01 GMT
Let me modify that to make it easier....

Use the onChange event of the combo and then set the RecordSource.

Select Case Me!ctlStatus
 Case "Active"
    Me.RecordSource = qryActiveStatus
 Case "Inactive"
    Me.RecordSource = qryInactiveStatus
End Select

BrerGoose
BWD - 30 Sep 2007 15:22 GMT
Thanks for your help.  Does this mean that using a filter is nt
possible or practical in this situation?  Asking because: 1) Did not
know if the filter was possible  B) Filtering is less work than
creating multiple queries.

Thanks
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.