Results 1 to 2 of 2
  1. #1
    vojinb is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Jul 2011
    Posts
    18

    Question multiple combo with multiple types filtering


    Hi, I have table where have columns with integer and character types of value:
    column1 (int), column2(char),column3(char)...etc
    On related form I have those 3 combo boxes and subform showing result based on values from combo boxes, and subform record source is like:
    select field1,field2,field3..... from my table where field1=forms!form!combo1.value and field2=forms!form!combo2.value
    but how to write code for second combo showing text values, I've tried "like" instead of "=" but not working.
    How to filter data on the subform using multiple type filtering through combo boxes?
    Thanks

  2. #2
    apr pillai's Avatar
    apr pillai is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    May 2010
    Location
    Alappuzha, India
    Posts
    209
    Since you are directly referencing the Combo Box control values as criteria in the SQL you don't have to write differently for Text data.

    Code:
    SELECT field1,field2,field3 FROM [my table] WHERE ([field1]=forms!mainForm!combo1.value AND [field2]=forms!mainForm!combo2.value AND [field3]=forms!mainForm!combo3.value);
    The above SQL can be set as Record Source for the sub-form but both Forms must be refreshed every time you change the value in those comboboxes to reflect the change in the sub-form.

    Write Click Event Procedures with the statement Me.Refresh for all the three comboboxes to run the refresh action whenever you make the Combobox selections.

    A far better and simple method is to use the Link Master Field, Link Child Field property settings on the Sub-Form. You can use the Combobox Control names in the Link Master Field property: Combo1;Combo2;Combo3 and in the Link Child Field Property their corresponding Field Names from the Sub-Form in the correct order. This will automatically refresh records on the Sub-Form based on changes you make on the Comboboxes. No need of any Click Event Procedures to refresh the change.

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

Similar Threads

  1. Filtering a report from multiple checkboxes
    By sabre1 in forum Reports
    Replies: 2
    Last Post: 01-17-2011, 03:37 PM
  2. Multiple filtering options in vba
    By eww in forum Programming
    Replies: 2
    Last Post: 09-28-2010, 01:46 PM
  3. Table design to Track Multiple Client Types
    By TannerT in forum Database Design
    Replies: 6
    Last Post: 06-02-2010, 08:21 PM
  4. Combo Box with multiple columns
    By desireemm1 in forum Access
    Replies: 1
    Last Post: 08-17-2009, 02:36 AM
  5. Multiple combo box
    By sparta363 in forum Forms
    Replies: 1
    Last Post: 06-22-2009, 02:03 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