Results 1 to 2 of 2
  1. #1
    sspreyer is offline Advanced Beginner
    Windows Vista Access 2007
    Join Date
    Nov 2013
    Posts
    36

    how to add tick boxs to filter


    hi all i have macro that searches a fields but not tick box fields i would like to show tick fields if yes is enter and if no enter then show not tick fields

    thanks for your help in advance here the macro
    Code:
    Name="Beep"/><Comment>Macro can't be run from the navigation pane.</Comment><Action Name="StopMacro"/></Statements><Sub Name="ApplyFilterFavorite"><Statements><ConditionalBlock><If><Condition>IsNull([Screen].[ActiveControl]) Or [Screen].[ActiveControl]=0</Condition><Statements><Comment>Clear Filters.</Comment><Action Name="RunMacro"><Argument Name="MacroName">Filters.ClearFilter</Argument></Action><Action Name="StopMacro"/></Statements></If></ConditionalBlock><ConditionalBlock><If><Condition>[Screen].[ActiveControl]=-1</Condition><Statements><Comment>Manage Filters.</Comment><Action Name="RunMacro"><Argument Name="MacroName">Filters.Manage</Argument></Action><Action Name="StopMacro"/></Statements></If></ConditionalBlock><Comment>Apply Filters</Comment><Action Name="SetTempVar"><Argument Name="Name">FilterString</Argument><Argument Name="Expression">DLookUp("[Filter String]","Filters","ID = " &amp; [Screen].[ActiveControl])</Argument></Action><Action Name="SetTempVar"><Argument Name="Name">SortString</Argument><Argument Name="Expression">DLookUp("[Sort String]","Filters","ID = " &amp; [Screen].[ActiveControl])</Argument></Action><ConditionalBlock><If><Condition>Not IsNull([TempVars]![FilterString])</Condition><Statements><Action Name="ApplyFilter"><Argument Name="WhereCondition">=[TempVars]![FilterString] &amp; IIf(Not [Form]![chkShowRetired],"and ([Retired Date ] is null or [Retired Date ] &gt; date())","")</Argument></Action></Statements></If></ConditionalBlock><ConditionalBlock><If><Condition>Not IsNull([TempVars]![FilterString])</Condition><Statements><Action Name="SetValue"><Argument Name="Item">[txtSearchBox]</Argument><Argument Name="Expression">""</Argument></Action></Statements></If></ConditionalBlock><ConditionalBlock><If><Condition>[CurrentProject].[IsTrusted] And Not IsNull([TempVars]![SortString])</Condition><Statements><Action Name="SetValue"><Argument Name="Item">[OrderBy]</Argument><Argument Name="Expression">Nz([TempVars]![SortString])</Argument></Action></Statements></If></ConditionalBlock><ConditionalBlock><If><Condition>[CurrentProject].[IsTrusted]</Condition><Statements><Action Name="SetValue"><Argument Name="Item">[OrderByOn]</Argument><Argument Name="Expression">Not IsNull([TempVars]![SortString])</Argument></Action></Statements></If></ConditionalBlock><Action Name="RemoveTempVar"><Argument Name="Name">FilterString</Argument></Action><Action Name="RemoveTempVar"><Argument Name="Name">SortString</Argument></Action></Statements></Sub><Sub Name="New"><Statements><Action Name="RunMacro"><Argument Name="MacroName">Filters.CheckFilter</Argument></Action><Action Name="RunMacro"><Argument Name="MacroName">Filters.SetupTempVars</Argument></Action><Action Name="OpenForm"><Argument Name="FormName">Filter Details</Argument><Argument Name="DataMode">Add</Argument><Argument Name="WindowMode">Dialog</Argument></Action><Action Name="Requery"><Argument Name="ControlName">cboFilterFavorites</Argument></Action><ConditionalBlock><If><Condition>[CurrentProject].[IsTrusted]</Condition><Statements><Action Name="SetValue"><Argument Name="Item">[Form]![cboFilterFavorites]</Argument><Argument Name="Expression">[TempVars]![LastFilterCreated]</Argument></Action></Statements></If></ConditionalBlock><Action Name="RunMacro"><Argument Name="MacroName">Filters.RemoveTempVars</Argument></Action></Statements></Sub><Sub Name="SetLastFilterID"><Statements><Comment>Used in conjunction with NEW to set the value of the combo box when trusted.</Comment><Action Name="SetTempVar"><Argument Name="Name">LastFilterCreated</Argument><Argument Name="Expression">[ID]</Argument></Action></Statements></Sub><Sub Name="Manage"><Statements><Action Name="SetTempVar"><Argument Name="Name">ObjectType</Argument><Argument Name="Expression">[Application].[CurrentObjectType]</Argument></Action><Action Name="SetTempVar"><Argument Name="Name">ObjectName</Argument><Argument Name="Expression">[Application].[CurrentObjectName]</Argument></Action><Action Name="OpenForm"><Argument Name="FormName">Filter Details</Argument><Argument Name="WhereCondition">[Object Name]=[Application].[CurrentObjectName]</Argument><Argument Name="WindowMode">Dialog</Argument></Action><Action Name="RunMenuCommand"><Argument Name="Command">Refresh</Argument></Action><Action Name="RemoveTempVar"><Argument Name="Name">ObjectType</Argument></Action><Action Name="RemoveTempVar"><Argument Name="Name">ObjectName</Argument></Action></Statements></Sub><Sub Name="SetupTempVars"><Statements><Action Name="SetTempVar"><Argument Name="Name">ObjectType</Argument><Argument Name="Expression">[Application].[CurrentObjectType]</Argument></Action><Action Name="SetTempVar"><Argument Name="Name">ObjectName</Argument><Argument Name="Expression">[Application].[CurrentObjectName]</Argument></Action><Action Name="SetTempVar"><Argument Name="Name">FilterString</Argument><Argument Name="Expression">[Filter]</Argument></Action><Action Name="SetTempVar"><Argument Name="Name">SortString</Argument><Argument Name="Expression">[OrderBy]</Argument></Action></Statements></Sub><Sub Name="RemoveTempVars"><Statements><Action Name="RemoveTempVar"><Argument Name="Name">ObjectType</Argument></Action><Action Name="RemoveTempVar"><Argument Name="Name">ObjectName</Argument></Action><Action Name="RemoveTempVar"><Argument Name="Name">FilterString</Argument></Action><Action Name="RemoveTempVar"><Argument Name="Name">SortString</Argument></Action><Action Name="RemoveTempVar"><Argument Name="Name">Order</Argument></Action><Action Name="RemoveTempVar"><Argument Name="Name">LastFilterCreated</Argument></Action></Statements></Sub><Sub Name="ClearFilter"><Statements><ConditionalBlock><If><Condition>[CurrentProject].[IsTrusted] And [Form].[Name]="Franklyn Shaw Jobs"</Condition><Statements><Action Name="SetValue"><Argument Name="Item">[Form]![cboFilterFavorites]</Argument><Argument Name="Expression">""</Argument></Action></Statements></If></ConditionalBlock><Comment>Clear Filter</Comment><Action Name="ApplyFilter"><Argument Name="WhereCondition">""</Argument></Action><ConditionalBlock><If><Condition>[Form].[Name]="Franklyn Shaw Jobs" And Not ([Form]![chkShowRetired])</Condition><Statements><Comment>Filter out Retired assets if checkbox is cleared</Comment><Action Name="ApplyFilter"><Argument Name="WhereCondition">="[Retired Date ] is null or [Retired Date ] &gt; date()"</Argument></Action></Statements></If></ConditionalBlock><Action Name="GoToControl"><Argument Name="ControlName">txtSearchBox</Argument></Action><Action Name="SetProperty"><Argument Name="ControlName">SearchClear</Argument><Argument Name="Property">Visible</Argument><Argument Name="Value">False</Argument></Action><Action Name="SetProperty"><Argument Name="ControlName">SearchGo</Argument><Argument Name="Property">Visible</Argument><Argument Name="Value">True</Argument></Action><ConditionalBlock><If><Condition>[CurrentProject].[IsTrusted]</Condition><Statements><Action Name="SetValue"><Argument Name="Item">[txtSearchBox]</Argument><Argument Name="Expression">""</Argument></Action></Statements></If></ConditionalBlock><Action Name="StopMacro"/></Statements></Sub><Sub Name="CheckFilter"><Statements><ConditionalBlock><If><Condition>Not ([Form].[FilterOn] Or [Form].[OrderByOn])</Condition><Statements><Action Name="MessageBox"><Argument Name="Message">You don't have a filter or sort to save.</Argument><Argument Name="Title">Save Filter</Argument></Action><Action Name="StopAllMacros"/></Statements></If></ConditionalBlock></Statements></Sub><Sub Name="QuickSearch"><Statements><ConditionalBlock><If><Condition>[txtSearchBox]=""</Condition><Statements><Comment>Clear Filter when search box empty</Comment><Action Name="RunMacro"><Argument Name="MacroName">Filters.ClearFilter</Argument></Action><Action Name="StopAllMacros"/></Statements></If></ConditionalBlock><ConditionalBlock><If><Condition>VarType([txtSearchBox])&lt;&gt;8</Condition><Statements><Action Name="StopAllMacros"/></Statements></If></ConditionalBlock><Action Name="SetProperty"><Argument Name="ControlName">SearchGo</Argument><Argument Name="Property">Visible</Argument><Argument Name="Value">True</Argument></Action><ConditionalBlock><If><Condition>[txtSearchBox]="" And [SearchClear].[Visible]&lt;&gt;0</Condition><Statements><Action Name="SetProperty"><Argument Name="ControlName">SearchClear</Argument><Argument Name="Property">Visible</Argument><Argument Name="Value">False</Argument></Action><Action Name="StopAllMacros"/></Statements></If></ConditionalBlock><Comment>Handle "'s in search</Comment><Action Name="SetTempVar"><Argument Name="Name">strSearch</Argument><Argument Name="Expression">Replace([txtSearchBox],"""","""""")</Argument></Action><Comment>Build the Filter for the Asset list</Comment><ConditionalBlock><If><Condition>[Form].[Name]="Franklyn Shaw Jobs"</Condition><Statements><Action Name="SetTempVar"><Argument Name="Name">strFilter</Argument><Argument Name="Expression">"([Item] Like ""*" &amp; [TempVars]![strSearch] &amp; "*"")"</Argument></Action></Statements></If></ConditionalBlock><ConditionalBlock><If><Condition>[Form].[Name]="Franklyn Shaw Jobs"</Condition><Statements><Action Name="SetTempVar"><Argument Name="Name">strFilter</Argument><Argument Name="Expression">[TempVars]![strFilter] &amp; " OR ([Description] Like ""*" &amp; [TempVars]![strSearch] &amp; "*"")"</Argument></Action></Statements></If></ConditionalBlock><ConditionalBlock><If><Condition>[Form].[Name]="Franklyn Shaw Jobs"</Condition><Statements><Action Name="SetTempVar"><Argument Name="Name">strFilter</Argument><Argument Name="Expression">[TempVars]![strFilter] &amp; " OR ([test] Like ""*" &amp; [TempVars]![strSearch] &amp; "*"")"</Argument></Action></Statements></If></ConditionalBlock><ConditionalBlock><If><Condition>[Form].[Name]="Franklyn Shaw Jobs"</Condition><Statements><Action Name="SetTempVar"><Argument Name="Name">strFilter</Argument><Argument Name="Expression">[TempVars]![strFilter] &amp; " OR ([Comments] Like ""*" &amp; [TempVars]![strSearch] &amp; "*"")"</Argument></Action></Statements></If></ConditionalBlock><ConditionalBlock><If><Condition>[Form].[Name]="Franklyn Shaw Jobs"</Condition><Statements><Action Name="SetTempVar"><Argument Name="Name">strFilter</Argument><Argument Name="Expression">[TempVars]![strFilter] &amp; " OR ([Category] Like ""*" &amp; [TempVars]![strSearch] &amp; "*"")"</Argument></Action></Statements></If></ConditionalBlock><ConditionalBlock><If><Condition>[Form].[Name]="Franklyn Shaw Jobs"</Condition><Statements><Action Name="SetTempVar"><Argument Name="Name">strFilter</Argument><Argument Name="Expression">[TempVars]![strFilter] &amp; " OR ([Model] Like ""*" &amp; [TempVars]![strSearch] &amp; "*"")"</Argument></Action></Statements></If></ConditionalBlock><ConditionalBlock><If><Condition>[Form].[Name]="Franklyn Shaw Jobs"</Condition><Statements><Action Name="SetTempVar"><Argument Name="Name">strFilter</Argument><Argument Name="Expression">IIf(Not [Form]![chkShowRetired],"([Retired Date ] is null or [Retired Date ] &gt; date()) AND (" &amp; [TempVars]![strFilter] &amp; ")",[TempVars]![strFilter])</Argument></Action></Statements></If></ConditionalBlock><Comment

  2. #2
    NTC is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2009
    Posts
    2,392
    One can't read the code in that little area.

    It appears that you are applying filtering to a form. I consider filtering to be applicable to the content and not to the structure of a form. So that if you want check boxes to literally not be visible - then this is a structure task rather than a content filter task.

    Using a macro, one has the conditional field option; you can put [formname].[controlname] = -1 as the condition and then make that same control not visible.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Run report based on Option and Combo Boxs
    By AussieGal in forum Access
    Replies: 3
    Last Post: 02-20-2013, 08:24 PM
  2. Tick Box in a Query
    By Cran29 in forum Queries
    Replies: 1
    Last Post: 06-15-2012, 05:33 PM
  3. Combo Boxs
    By clean32 in forum Forms
    Replies: 2
    Last Post: 06-14-2011, 08:48 AM
  4. sub forms & combo boxs
    By clean32 in forum Forms
    Replies: 38
    Last Post: 06-13-2011, 06:59 PM
  5. Working with Two Combo boxs
    By Della Smith in forum Database Design
    Replies: 2
    Last Post: 08-01-2008, 02:52 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums