If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Need form filtered based on criteria
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 |
#2
|
|||
|
|||
Need form filtered based on criteria
Hi
I have no idea but would love to know why you cannot use query "Destin Richter" wrote in message ... 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 |
#3
|
|||
|
|||
Need form filtered based on criteria
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 "Destin Richter" wrote in message ... 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 |
Thread Tools | |
Display Modes | |
|
|