logo
down
shadow

A combo box that has to be filter the same data in that field


A combo box that has to be filter the same data in that field

By : oBitOWhit
Date : January 11 2021, 05:14 PM
I wish did fix the issue. First off, I'm going to use VBA for this. To access the VBA menu in your Access file, press ALT + F11.
Secondly, I can't give you a full tutorial on VBA here. You'll have to work out any kinks yourself.
code :
| Field Name | Data Type  |
---------------------------
| CityIndex  | Short Text | * Unique index for each city; Foreign key in DimStudent table
| CityKey    | Short Text | * Will serve to make City1, City2, etc
| City       | Short Text | * Name of each city
| Field Name | Data Type  |
---------------------------
| StudentKey | Short Text | * Unique key for each student
| CityIndex  | Short Text | * CityIndex is a foreign key here
| LastName   | Short Text | * Student last name
| FirstName  | Short Text | * Student first name
SELECT DimStudent.StudentKey
, DimCity.CityIndex
, DimStudent.LastName
, DimStudent.FirstName
, DimCity.CityKey
, DimCity.City, "City" & CStr([CityKey]) AS CityID -- Convert the CityKey to a string
FROM DimCity
INNER JOIN DimStudent ON DimCity.CityIndex = DimStudent.CityIndex;
SELECT vwTerritoryStudent.CityKey
, vwTerritoryStudent.CityID
FROM vwTerritoryStudent
GROUP BY vwTerritoryStudent.CityKey
, vwTerritoryStudent.CityID;
SELECT vwTerritoryStudent.StudentKey
, vwTerritoryStudent.FirstName
, vwTerritoryStudent.LastName
, vwTerritoryStudent.CityKey
FROM vwTerritoryStudent;
Option Compare Database
Option Explicit
Private filter_str As String ' Create a local variable to keep things simple

Private Sub City_combo_AfterUpdate()
' After update on whatever your combobox with 'CityID' values is

' Call our MyFilter subprocess
Call MyFilter

End Sub

Private Sub Form_Close()
' Clear up the filter when closing the form
' This is a good habit to get into unless the end user wants
' to have the form filtered the exact same way when they reopen it.
With Me
    .Form.Filter = ""
    .Form.FilterOn = False
End With
End Sub

Private Sub Form_Load()
' On load action

' Call our MyFilter subprocess
Call MyFilter

End Sub


Public Sub MyFilter()

' Call SetFilter evaluation subprocess
Call SetFilter

' Evaluate results of SetFilter subprocess
With Me
    .Form.Filter = filter_str ' Set filter to whatever the module-level filter_str variable is
    If Len(Nz(filter_str)) > 0 Then
        .FilterOn = True
    Else
        .FilterOn = False ' Set FilterOn = False if no filter value set.
    End If
End With

End Sub

Public Sub SetFilter()
' Determine if our combobox contains a value
' if it does, set our module-level filter string to
' the CityKey value
With Me
    If Len(Nz(.City_combo.Value)) > 0 Then
        filter_str = "[CityKey] = " & .City_combo.Value
    Else
        filter_str = ""
    End If
End With

End Sub


Share : facebook icon twitter icon
Filter a grid's data using a selected value in combo box

Filter a grid's data using a selected value in combo box


By : David Burgett
Date : March 29 2020, 07:55 AM
this one helps. First you need a combobox that will also allow you to clear your filter. So you will need a second button on the combobox which allows you to clear if a filter is active. For that you don't need to do much because the framework already cover such a feature, even if it is not documented.
Here's a older version but it should still work on 4.2
code :
Ext.define('Ext.ux.form.field.FilterCombo', {
    extend: 'Ext.form.field.ComboBox',
    alias: 'widget.filtercombo',
    /**
    * @cfg {string} recordField
    * @required
    * The fieldname of the record that contains the filtervalue
    */

    /**
    * @cfg {string} searchField
    * @required
    * The fieldname on which the filter should be applied
    */

    /**
    * @cfg {boolean} clearable
    * Indicates if the clear trigger should be hidden. Defaults to <tt>true</tt>.
    */
    clearable: true,

    initComponent: function () {
        var me = this;
        // never submit it
            me.submitValue = false;
        if (me.clearable)
            me.trigger2Cls = 'x-form-clear-trigger';
        else
            delete me.onTrigger2Click;

        me.addEvents(

            /**
            * @event clear
            *
            * @param {Ext.ux.form.field.FilterCombo} FilterCombo The filtercombo that triggered the event
            */
            'clear',
            /**
            * @event beforefilter
            *
            * @param {Ext.ux.form.field.FilterCombo} FilterCombo The filtercombo that triggered the event
            * @param {String/Number/Boolean/Float/Date} value The value to filter by
            * @param {string} field The field to filter on
            */
            'beforefilter'
        );

        me.callParent(arguments);
        // fetch the id the save way
        var ident = me.getId();

        me.on('select', function (me, rec) {
            var value = rec[0].data[me.recordField],
                field = me.searchField;
            me.fireEvent('beforefilter', me, value, field)
            me.onShowClearTrigger(true); 
            me.onSearch(value, field);
        }, me);
        me.on('afterrender', function () { me.onShowClearTrigger(); }, me);
    },

    /**
    * @abstract onSearch
    * running a search on the store that may be removed separately
    * @param {String/Number/Boolean/Float/Date} val The value to search for
    * @param {String} field The name of the Field to search on
    */
    onSearch: Ext.emptyFn,

    /**
    * @abstract onFilterRemove
    * removing filters from the the
    * @param {Boolean} silent Identifies if the filter should be removed without reloading the store
    */
    onClear: Ext.emptyFn,

    onShowClearTrigger: function (show) {
        var me = this;
        if (!me.clearable)
            return;
        show = (Ext.isBoolean(show)) ? show : false;
        if (show) {
            me.triggerEl.each(function (el, c, i) {
                if (i === 1) {
                    el.setWidth(el.originWidth, false);
                    el.setVisible(true);
                    me.active = true;
                }
            });
        } else {
            me.triggerEl.each(function (el, c, i) {
                if (i === 1) {
                    el.originWidth = el.getWidth();
                    el.setWidth(0, false);
                    el.setVisible(false);
                    me.active = false;
                }
            });
        }
        // Version specific methods
        if (Ext.lastRegisteredVersion.shortVersion > 407) {
            me.updateLayout();
        } else {
            me.updateEditState();
        }
    },

    /**
    * @override onTrigger2Click
    * eventhandler
    */
    onTrigger2Click: function (args) {
        this.clear();
    },

    /**
    * @private clear
    * clears the current search
    */
    clear: function () {
        var me = this;
        if (!me.clearable)
            return;
        me.onClear(false);
        me.clearValue();
        me.onShowClearTrigger(false);
        me.fireEvent('clear', me);
    }
});
remoteSort: false,  
remoteFilter: false, 
remoteGroup: false
{
    xtype: 'filtercombo',
    id: 'iccombo',
    store: Ext.StoreMgr.lookup('Combostore'),
    fieldLabel: 'Short State',
    displayField: 'States',
    valueField: 'States',   
    typeAhead: true,
    triggerAction: 'all',
    queryMode: 'remote',
    name: 'State',
    labelWidth: 125,
    anchor: '95%',
    recordField: 'ComboStoreFieldName',
    searchField: 'GridStoreFieldName',
    clearable: false,
    onSearch: function (me, value, field) {

        // You many also use component query to access your grid and call getStore()
        var store = Ext.StoreMgr.lookup('YourStoreIdName');

        // Clear existing filters
            if (store.isFiltered()) {
            store.clearFilter(false);
            }
        // Build filter

        // Apply filter to store
        store.filter(field,value);
    }
}
how to use multiple combo boxes to filter data

how to use multiple combo boxes to filter data


By : Curious Joe
Date : March 29 2020, 07:55 AM
To fix this issue can someone please help me with this problem i'm a beginner in programming. , you just have to add another condition in your If statement:
code :
 If Me.cboSearchBy.Text = "1st"  and Me.cboSY.Text = "2014-2015" Then
    sSQL = sSQL & " where Sem like '1st" & Me.txtSearch.Text & "%' and SY like '" & Me.cboSY.Text & "%' "
 Else
    sSQL = sSQL & " where Sem like '2nd" & Me.txtSearch.Text & "%' and SY like '" & Me.cboSY.Text & "%' "
 End If
How to use multiple combo boxes to filter data in MS Access?

How to use multiple combo boxes to filter data in MS Access?


By : user3627835
Date : March 29 2020, 07:55 AM
it helps some times I have done it. Here is the solution.
I have made 4 combo boxes on my form as below and all fields from the Tasks table:
code :
    SELECT [Owner List].[Owner ID], [Owner List].[Owner Name]
    FROM [Owner List];
    Requery -> Combo2
    Requery -> Combo4
    Requery -> Combo8
    SELECT [Project List].[Project ID], [Project List].[Project Name]
    FROM [Project List]
    WHERE ((([Project List].[Owner ID])=[Forms]![Form1]![combo0]));
    Requery -> Combo4
    Requery -> Combo8
    SELECT [Parts List].[Part ID], [Parts List].[Section Name]
    FROM [Project List] RIGHT JOIN [Parts List] ON [Project List].[Project    ID] = [Parts List].[Project ID]
    WHERE ((([Parts List].[Project ID])=[forms]![Form1]![Combo2]) AND (([Project List].[Owner ID])=[Forms]![Form1]![Combo0]));
    Requery -> Combo8
    SELECT [Subparts List].[Subpart ID], [Subparts List].[Subpart Name]
    FROM [Project List] RIGHT JOIN ([Project Parts] RIGHT JOIN [Subparts List] ON [Project Parts].[Part ID] = [Subparts List].[Part ID]) ON [Project List].[Project ID] = [Project Parts].[Project ID]
    WHERE ((([Subparts List].[Part ID])=[Forms]![Form1]![Combo4]) AND (([Project Parts].[Project ID])=[Forms]![Form1]![Combo2]) AND (([Project List].[Owner ID])=[Forms]![Form1]![Combo0]));
    ApplyFilter -> =" [Subpart ID] = " & [Combo8] & ""
Requery -> `Combo2` 
    Requery -> `Combo4` 
    Requery -> `Combo8` 
Requery -> `Combo4` 
    Requery -> `Combo8` 
Requery -> `Combo8` 
ApplyFilter -> =" [Subpart ID] = " & [Combo8] & "" 
how to filter a combo box that is created by a Ng-Repeat based on the same combo box in the previous row in Angular js?

how to filter a combo box that is created by a Ng-Repeat based on the same combo box in the previous row in Angular js?


By : Gregor
Date : March 29 2020, 07:55 AM
To fix this issue There is many approaches to achieve this. here is two of them:
Method 1: Using Angular Filter In HTML
code :
var MainApplication = angular.module('mainApplication', []);

MainApplication.controller('mainController', ['$scope', function($scope) {
  $scope.AddressPrefix = [{
    id: 1,
    Title: 'AAA',
    priority: 1
  }, {
    id: 1,
    Title: 'BBB',
    priority: 2
  }, {
    id: 1,
    Title: 'CCC',
    priority: 3
  }, {
    id: 1,
    Title: 'DDD',
    priority: 4
  }, {
    id: 1,
    Title: 'EEE',
    priority: 5
  }, {
    id: 1,
    Title: 'FFF',
    priority: 6
  }, {
    id: 1,
    Title: 'GGG',
    priority: 7
  }, {
    id: 1,
    Title: 'HHH',
    priority: 8
  }, {
    id: 1,
    Title: 'III',
    priority: 2
  }, {
    id: 1,
    Title: 'jjj',
    priority: 2
  }, {
    id: 1,
    Title: 'kkk',
    priority: 2
  }, {
    id: 1,
    Title: 'LLL',
    priority: 10
  }, {
    id: 1,
    Title: 'MMM',
    priority: 9
  }, {
    id: 1,
    Title: 'ooo',
    priority: 7
  }, {
    id: 1,
    Title: 'PPP',
    priority: 12
  }, {
    id: 1,
    Title: 'qqq',
    priority: 3
  }, {
    id: 1,
    Title: 'RRR',
    priority: 13
  }, {
    id: 1,
    Title: 'zzz',
    priority: 14
  }, ];

  $scope.AddressControls = [{
    id: 1
  }];
  $scope.btnAddressAdd_click = function() {
    var newItemNo = $scope.AddressControls.length + 1
    $scope.AddressControls.push({
      'id': newItemNo
    });
  };
  $scope.btnAddressRemove_click = function() {
    $scope.AddressControls.pop();
  };

  $scope.myFilter = function(index) {
    return function(option, optionIndex, allOptions) {
      var lastSelectedOption = (index > 0) && $scope.AddressControls[index - 1] && $scope.AddressControls[index - 1].prefixSelecteditem;
      if (!lastSelectedOption) return true;
      return option.priority > lastSelectedOption.priority;
    }
  }
}]);
<html ng-app="mainApplication">

<head>
  <title></title>

  <meta charset="utf-8" />
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.5/angular.min.js"></script>
</head>

<body dir="rtl" ng-controller="mainController">
  <div class="row">

    <div class="col-sm-6">
      <button type="button" id="btnAddressAdd" class="btn btn-primary" ng-click="btnAddressAdd_click()">
				<span class="glyphicon glyphicon glyphicon-plus" aria-hidden="true" style="font-size:1.2em"></span>
			</button>
      <button type="button" id="btnAddressRemove" class="btn btn-danger" ng-click="btnAddressRemove_click()" ng-disabled="AddressControls.length==1">
				<span class="glyphicon glyphicon-minus" aria-hidden="true" style="font-size:1.2em"></span>
			</button>
    </div>
  </div>
  <hr />

  <fieldset class="row " id="Address" ng-repeat="item in AddressControls track by $index" ng-disabled="$first">

    <div class="col-sm-1">
      <div class="form-group">

        <label>
				prefix
				</label>
      </div>
    </div>
    <div class="col-sm-3">
      <div class="form-group">
        <span></span>
        <select class="form-control" ng-model="item.prefixSelecteditem" ng-options="prefix.Title for prefix in AddressPrefix | filter: myFilter($index)">
					<option value="">--select option--</option>
				</select>
      </div>
    </div>
    <div class="col-sm-4">
      <div class="form-group">
        <div class="errorBlock">
        </div>
        <input class="form-control" type="text" value="" style="height:32px">
      </div>
    </div>

  </fieldset>


</body>

</html>
var MainApplication = angular.module('mainApplication', []);

MainApplication.controller('mainController', ['$scope', function($scope) {
  $scope.AddressPrefix = [{
    id: 1,
    Title: 'AAA',
    priority: 1
  }, {
    id: 1,
    Title: 'BBB',
    priority: 2
  }, {
    id: 1,
    Title: 'CCC',
    priority: 3
  }, {
    id: 1,
    Title: 'DDD',
    priority: 4
  }, {
    id: 1,
    Title: 'EEE',
    priority: 5
  }, {
    id: 1,
    Title: 'FFF',
    priority: 6
  }, {
    id: 1,
    Title: 'GGG',
    priority: 7
  }, {
    id: 1,
    Title: 'HHH',
    priority: 8
  }, {
    id: 1,
    Title: 'III',
    priority: 2
  }, {
    id: 1,
    Title: 'jjj',
    priority: 2
  }, {
    id: 1,
    Title: 'kkk',
    priority: 2
  }, {
    id: 1,
    Title: 'LLL',
    priority: 10
  }, {
    id: 1,
    Title: 'MMM',
    priority: 9
  }, {
    id: 1,
    Title: 'ooo',
    priority: 7
  }, {
    id: 1,
    Title: 'PPP',
    priority: 12
  }, {
    id: 1,
    Title: 'qqq',
    priority: 3
  }, {
    id: 1,
    Title: 'RRR',
    priority: 13
  }, {
    id: 1,
    Title: 'zzz',
    priority: 14
  }, ];

  $scope.AddressControls = [{
    id: 1
  }];
  $scope.btnAddressAdd_click = function() {
    var newItemNo = $scope.AddressControls.length + 1
    $scope.AddressControls.push({
      'id': newItemNo
    });
  };
  $scope.btnAddressRemove_click = function() {
    $scope.AddressControls.pop();
  };

  $scope.myFilter = function(arr, index) {
    var lastSelectedOption = (index > 0) && $scope.AddressControls[index - 1] && $scope.AddressControls[index - 1].prefixSelecteditem;
    if (!lastSelectedOption) return arr;
    return arr.filter(function (option) {
      return option.priority > lastSelectedOption.priority;
    });
  }
}]);
<html ng-app="mainApplication">

<head>
  <title></title>

  <meta charset="utf-8" />
  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.5/angular.min.js"></script>
</head>

<body dir="rtl" ng-controller="mainController">
  <div class="row">

    <div class="col-sm-6">
      <button type="button" id="btnAddressAdd" class="btn btn-primary" ng-click="btnAddressAdd_click()">
				<span class="glyphicon glyphicon glyphicon-plus" aria-hidden="true" style="font-size:1.2em"></span>
			</button>
      <button type="button" id="btnAddressRemove" class="btn btn-danger" ng-click="btnAddressRemove_click()" ng-disabled="AddressControls.length==1">
				<span class="glyphicon glyphicon-minus" aria-hidden="true" style="font-size:1.2em"></span>
			</button>
    </div>
  </div>
  <hr />

  <fieldset class="row " id="Address" ng-repeat="item in AddressControls track by $index" ng-disabled="$first">

    <div class="col-sm-1">
      <div class="form-group">

        <label>
				prefix
				</label>
      </div>
    </div>
    <div class="col-sm-3">
      <div class="form-group">
        <span></span>
        <select class="form-control" ng-model="item.prefixSelecteditem" ng-options="prefix.Title for prefix in myFilter(AddressPrefix, $index)">
					<option value="">--select option--</option>
				</select>
      </div>
    </div>
    <div class="col-sm-4">
      <div class="form-group">
        <div class="errorBlock">
        </div>
        <input class="form-control" type="text" value="" style="height:32px">
      </div>
    </div>

  </fieldset>


</body>

</html>
Filter a Query based on 10 combo boxes but if combo box is blank show All records including empty,

Filter a Query based on 10 combo boxes but if combo box is blank show All records including empty,


By : user1908443
Date : March 29 2020, 07:55 AM
it fixes the issue I have list box pulls data from a query based on criteria's selected from Combo Boxes (the combo Boxes are filled whit Data from the same table every combo box from another column). , I found a code whats work type in query designer the following:
code :
Like "*" & [Forms]![myForm]![myControl] & "*" OR [Forms]![myForm]![myControl] Is 
Null 
Related Posts Related Posts :
  • Date Condition with Case when Holiday exclude
  • SQL Query Select from 1 table and return data based on 2 columns
  • how to use rank/join and where together
  • How to create new column with values counting up every 9th value with SQL?
  • More Elegant way to Batch Validate Phone Numbers
  • SQL find parent where children match over multiple rows
  • Exclude updated record from trigger function
  • Insert into table from select only when select returns valid rows
  • How to fix SQLite3::SQLException: near "to": syntax error: SELECT "".* FROM "" WHERE "
  • Filter msdb.dbo.sysjobsteps.command into seperate columns
  • How to extract year or month,day from oracle function without using sub-query?
  • Reset sum when condition is met in Oracle
  • Date Between (Start & Now)
  • Reset running sum when condition is met in Oracle
  • Why is my date criteria filtering incorrectly in a MsysObjects query using DCount?
  • Stripping date/time delimiters in an SSIS csv export
  • SSIS Error on insertion - Error when new primary keys in Dimension table
  • How can I make a temp table of specific datetime data within a range?
  • AnalysisException: Syntax error in SQL After multiple join
  • SQL Query Multiple Columns Using Distinct on One Column Only and Using Order By
  • Sum inventory item groups
  • TSQL: Parsing strings with various characters
  • Using SQL Server : how to use select criteria based on sum
  • Inserting dynamic pivot Result into Temp table
  • Joining multiple fields in a dataset joined with descriptions
  • Conditional WHERE EXISTS in Oracle query
  • How to get the count of each unique value in a column between two dates?
  • SQL: Select only if multiple values are IN 1 column from CatalogTable
  • In a query (no editing of tables) how do I join data without any similarities?
  • Create nested json blobs in PostgreSQL
  • Getting extra dates while using cte
  • Way to alter one table if another was altered
  • Proper use of semicolons in functions and procedures
  • Cursor Not looping all the Records
  • Select inner join returns wrong result
  • Group By showing duplicates
  • Error in using subquery in access join query
  • How do I use a composite pk in a stored procedure?
  • How to convert decode function in oracle to standard big query
  • Postgresql: An alternative to subqueries to make the query more efficient?
  • Use returned values from a query in the same procedure
  • Sum all numeric columns in database and log results
  • Release item in current year
  • Conditional function not working as intended postgresql
  • SQL trigger, results not Grouped by
  • getting more records than expected with simple query in postgresql
  • get first occurrence of a certain combination of columns
  • Converting string timestamp to local-time zone in Oracle
  • Redshift - Filter out rows that are blank to left or right of a character
  • Teradata - Know the load volume by times of a table
  • How do I replace duplicate data with random data of same length in SQL
  • How to group by using pivot table
  • How can I achieve a Join for merging two tables FULL OUTER JOIN and avoid duplicates?
  • Multi Keyword search on multi-column sql
  • Computing the median of salaries under each manager in BigQuery SQL
  • How can insert value by selecting from another
  • Retrieving only the latest item for a set of data
  • update column with concatenating for that group only
  • SQL `SELECT 'some string value' AS fieldname` equivalent in Powershell?
  • How to determine the AVERAGE number of associated records
  • shadow
    Privacy Policy - Terms - Contact Us © festivalmusicasacra.org