none
Expression Syntex RRS feed

  • Question

  • I trying to write an expression but need some help.

    I have a filter on a from that runs when a command button is pressed. It works but I want to add to it.

    The current filter is: [qryWords]!WordGroup="1"

    It chooses WordGroup 1   but I also want it to filter a check box named Learned and I just want to show the ones without a check in the check box. In other words I want only the ones that aren't checked.


    C vivid

    Wednesday, July 15, 2015 5:44 PM

Answers

  • SELECT WordID, WordGroup, WordValue, WordLearned FROM tblWords WHERE WordGroup = 1 AND WordLearned=False;

    NOTE: Unless you have defined WordGroup as Text data type, the criteria should not be in quotes.  It most likely should be a Long Integer or Integer data type given your example above. 

    I realize that you are looking for a filter for your form, but the above illustrates what a query would look like for learning purposes.  I've seen your other posts and advice others have given you for table design and form development.  The query above models exactly what your table should look like and provides the WHERE condition to look up the data you want from your table.

    A form filter would be similar to the WHERE condition.

    Flter: "WordGroup = 1 AND WordLearned = False"

    Just FYI, True = -1 and can be evaluated to any value other than 0, and False = 0.  You can use True and False in your criteria or you can use the numeric values, either way.

    • Edited by RunningManHD Wednesday, July 15, 2015 6:07 PM
    • Marked as answer by C Vivid Wednesday, July 15, 2015 6:12 PM
    • Unmarked as answer by C Vivid Friday, July 17, 2015 4:52 PM
    • Marked as answer by C Vivid Friday, July 17, 2015 4:52 PM
    Wednesday, July 15, 2015 5:55 PM
  • [qryWords]!WordGroup="1" and [Checkbox] = -1
    • Marked as answer by C Vivid Wednesday, July 15, 2015 6:11 PM
    Wednesday, July 15, 2015 5:55 PM
  • Thanks Running ManHD!

    That was exactly what I needed. I made the change and it works great

    Much Appreciated!!!


    C vivid

    • Marked as answer by C Vivid Friday, July 17, 2015 4:53 PM
    Wednesday, July 15, 2015 6:01 PM
  • No problem... But, please see my additional notes. 

    Also, please be sure to mark your posts as answered when the question is resolved.

    Thanks,

    • Marked as answer by C Vivid Friday, July 17, 2015 4:53 PM
    Wednesday, July 15, 2015 6:08 PM

All replies

  • SELECT WordID, WordGroup, WordValue, WordLearned FROM tblWords WHERE WordGroup = 1 AND WordLearned=False;

    NOTE: Unless you have defined WordGroup as Text data type, the criteria should not be in quotes.  It most likely should be a Long Integer or Integer data type given your example above. 

    I realize that you are looking for a filter for your form, but the above illustrates what a query would look like for learning purposes.  I've seen your other posts and advice others have given you for table design and form development.  The query above models exactly what your table should look like and provides the WHERE condition to look up the data you want from your table.

    A form filter would be similar to the WHERE condition.

    Flter: "WordGroup = 1 AND WordLearned = False"

    Just FYI, True = -1 and can be evaluated to any value other than 0, and False = 0.  You can use True and False in your criteria or you can use the numeric values, either way.

    • Edited by RunningManHD Wednesday, July 15, 2015 6:07 PM
    • Marked as answer by C Vivid Wednesday, July 15, 2015 6:12 PM
    • Unmarked as answer by C Vivid Friday, July 17, 2015 4:52 PM
    • Marked as answer by C Vivid Friday, July 17, 2015 4:52 PM
    Wednesday, July 15, 2015 5:55 PM
  • [qryWords]!WordGroup="1" and [Checkbox] = -1
    • Marked as answer by C Vivid Wednesday, July 15, 2015 6:11 PM
    Wednesday, July 15, 2015 5:55 PM
  • [qryWords]!WordGroup="1" and [Checkbox] = -1
    1. Hopefully the OP is not using the nomenclature "Checkbox" for a field name as it is a reserved word. 
    2. WordGroup appears to be a Long Integer or Integer value, so no quotes should be used.
    3. The criteria request is for records where the check is False, your example is for True.
    Wednesday, July 15, 2015 5:59 PM
  • Thanks Running ManHD!

    That was exactly what I needed. I made the change and it works great

    Much Appreciated!!!


    C vivid

    • Marked as answer by C Vivid Friday, July 17, 2015 4:53 PM
    Wednesday, July 15, 2015 6:01 PM
  • No problem... But, please see my additional notes. 

    Also, please be sure to mark your posts as answered when the question is resolved.

    Thanks,

    • Marked as answer by C Vivid Friday, July 17, 2015 4:53 PM
    Wednesday, July 15, 2015 6:08 PM