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 / Forms / May 2008

Tip: Looking for answers? Try searching our database.

Need form filtered based on criteria

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Destin Richter - 06 May 2008 21:24 GMT
Hi, I have a main form, based on a table (not a query, and that won't
change).  Need code behind a new command button that filters my form such
that any record with the field "Current" (yes/no) set to Yes shows up.  Will
make another command button to show No only, and another to remove the filter
(showing all).  Can you provide the code I need?  Assume tblEmployees and
frmEmployees are components.

Thank you!

Destin Richter
richter@newmexico.com
Derek - 06 May 2008 22:35 GMT
Hi
I have no idea but would love to know why you cannot use query

> Hi, I have a main form, based on a table (not a query, and that won't
> change).  Need code behind a new command button that filters my form such
[quoted text clipped - 9 lines]
> Destin Richter
> richter@newmexico.com
Damon Heron - 07 May 2008 00:05 GMT
You could certainly use the filter property to do this:  put an option group
with three choices on your frmEmployees, calling it frameCurrent, and a
value of 1,2,3 for the options. Have one command button (called cmdFilter in
this example). there should also be a control with the source of "Current"
on the form. (this is untested code, but it should get you started)

Private Sub cmdFilter_Click()
On Error GoTo Err_cmdFilter_Click

select case (Me.frameCurrent.Value)

case 1
me.filter= "[Current]= Yes"
me.filteron=true
case 2
me.filter= "[Current]= No"
me.filteron=true
case 3
me.filteron= false
end select

Exit_cmdFilter_Click:
   Exit Sub

Err_cmdFilter_Click:
   MsgBox Err.Description
   Resume Exit_cmdFilter_Click

End Sub

> Hi, I have a main form, based on a table (not a query, and that won't
> change).  Need code behind a new command button that filters my form such
[quoted text clipped - 9 lines]
> Destin Richter
> richter@newmexico.com
 
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.