Results 1 to 5 of 5
  1. #1
    Patience is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    May 2010
    Posts
    52

    Newbie question

    Hello all,

    I have a very basic issue here I guess. I hope you can help me.

    I want the following to happen:



    From a form the user can chose between multiple checkboxes. More than one checkbox can be ticked at the same time. I want the choise of checkboxes to determine which data from a table should be used in a report.

    I have made the form, the checkboxes, the table and the report. But how do I make a query that allows me to make multiple filters in the same table based on the ticked checkboxes???

    Thanks in advance.

  2. #2
    ConneXionLost's Avatar
    ConneXionLost is offline Simulacrum
    Windows XP Access 2003
    Join Date
    Jan 2010
    Location
    Victoria, Canada
    Posts
    291
    Set the criteria in your query to be the value of your checkboxes.

    e.g.

    [Forms]![YourForm]![YourCheckBox].[Value]

  3. #3
    Patience is offline Advanced Beginner
    Windows XP Access 2003
    Join Date
    May 2010
    Posts
    52
    I simply can not get it to work. Allow me to be more specific:

    Table name: T1
    Form name: F1
    Checkboxes located at F1: C1, C2, C3
    If C1 is ticked: "Cars" records from T1 are included in the query results
    If C2 is ticked: "Bikes" records from T1 are included in the query results
    If C3 is ticked: "Trains" records from T1 are included in the query results

    Multiple checkboxes can be ticked at the same time.

    How exactly should my query look like in order to do this? I have upgraded to 2010, so please write the expressions in the propper "language".

    Thank you very much in advance!

  4. #4
    ConneXionLost's Avatar
    ConneXionLost is offline Simulacrum
    Windows XP Access 2003
    Join Date
    Jan 2010
    Location
    Victoria, Canada
    Posts
    291
    You didn't say what the name of your field is in T1, so you'll need to add it in place of "YourFieldName" in this query:

    Code:
    SELECT T1.*
    FROM T1
    WHERE (((T1.YourFieldName)=IIf([Forms]![F1]![C1]=-1,"Cars","") Or (T1.YourFieldName)=IIf([Forms]![F1]![C2]=-1,"Bikes","") Or (T1.YourFieldName)=IIf([Forms]![F1]![C3]=-1,"Trains","")));
    Ensure this query is used as the source for your report.

  5. #5
    Patience is offline Advanced Beginner
    Windows XP Access 2010 (version 14.0)
    Join Date
    May 2010
    Posts
    52
    Thank you for your suggestion. I've tried it, but I still can't get it to work.

    When I read about the IIF it seems that it only returns one value depending on whether it is true or false.

    What I want to do is to have all records beginning with e.g. "Cars" to be shown in the query result. But no matter what I write, the result is an emty list.

    I've tried with:

    WHERE (((T1.Text)=IIf([Forms]![F1]![C1]=-1,"Cars*","")));

    WHERE (((T1.Text)=IIf([Forms]![F1]![C1]=-1,Like "Cars*","")));

    WHERE (((T1.Text)=IIf([Forms]![F1]![C1]=-1,Like ("Cars*)","")));

    And many more.

    Any ideas?

    Thank you very much!

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

Similar Threads

  1. Very Newbie Question
    By paralogical in forum Access
    Replies: 4
    Last Post: 10-11-2010, 06:55 PM
  2. vba question from newbie
    By ninachopper in forum Access
    Replies: 17
    Last Post: 07-29-2010, 01:22 PM
  3. Newbie question
    By webby in forum Access
    Replies: 6
    Last Post: 07-19-2010, 06:22 AM
  4. Question from a newbie
    By scarps626 in forum Access
    Replies: 2
    Last Post: 10-02-2009, 03:40 AM
  5. Newbie question
    By The_Dude in forum Programming
    Replies: 2
    Last Post: 12-23-2007, 07:11 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