Results 1 to 5 of 5
  1. #1
    phool4fool is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Dec 2011
    Posts
    7

    how to show data only from selected combo boxes ?


    I've created a form where I've used 5 combo boxes all are working fine & i'm getting all information.
    Following are the combo boxes:
    City - School - Class - Gender - Grade
    --All - --All - --All - --All - --All
    --city1 - --school1 - --class1 - --Male - --A+
    --city2 - --school2 - --class2 - --Female - --A

    See, I've combo for city where I've 'All, city1 & city2' in drop down & same for others.
    I want the following result:
    If I select city1 from City & All from Gender, it should show only the data according to the selected combo boxes. But, here I'm getting the related information but all other columns are showing but with no data. So, what should I do to only show relevant columns in output not all columns with no data in it.
    Really need help?
    Waiting for a solution....!!!

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Is this what you are trying to do
    http://datapigtechnologies.com/flash...earchform.html
    http://datapigtechnologies.com/flash...tomfilter.html

    How are you handling a selection of 'All'? I expect isn't working because none of your fields have value 'All' so nothing matches that criteria. How did you get 'All' into the combobox RowSource - a UNION query?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    phool4fool is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Dec 2011
    Posts
    7
    everything is working... the only thing I want is:
    what if I don't want to search for Grade & I only choose other combo boxes. It also show Grade information which I don't want to see

  4. #4
    orange's Avatar
    orange is online now Moderator
    Windows XP Access 2003
    Join Date
    Sep 2009
    Location
    Ottawa, Ontario, Canada; West Palm Beach FL
    Posts
    16,726
    If you don't want to see values for a particular field, then remove that field from the SELECT query underlying your Search routine.

  5. #5
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Why is showing the data an issue?

    If you don't want to show a field for which no criteria is input into combobox, then as Orange said, modify the SELECT query that references the comboboxes as parameters.

    Another approach would be to have expression in query to calculate an alias field name:

    StudentGrades: IIf(IsNull(Forms!formname!comboboxname), "", [Grades]))

    Now put combobox paramater in the criteria under this column. The fieldname will still show but no data if combobox is empty.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Calculating sum of selected option/combo boxes
    By SgtSaunders69 in forum Forms
    Replies: 4
    Last Post: 08-04-2014, 09:20 PM
  2. Visible text boxes when combo box choice selected
    By nichmeg in forum Programming
    Replies: 3
    Last Post: 10-16-2011, 02:53 PM
  3. Replies: 2
    Last Post: 07-31-2011, 04:03 AM
  4. Replies: 1
    Last Post: 07-30-2011, 03:21 PM
  5. Replies: 1
    Last Post: 03-27-2010, 06:13 AM

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