• filtering a query with IIf statement problem

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » filtering a query with IIf statement problem

    Author
    Topic
    #2276189

    I get code blocked when inserting the sql I want to ask about, so.

    I want to filter PO records only if a value is greater than 7. 7 is a rep number. I want reps greater than 7 to only see their own PO’s but anyone less (managers) to be able to see all PO’s.

    I’m trying to use an IIF statement with Like “*” as the false value but it returns nothing.

    Viewing 4 reply threads
    Author
    Replies
    • #2276192

      Here is a pic showing my code

       

      Annotation-2020-06-29-152634

    • #2276199

      I would have expected something like “select * where userinfo > 7” rather than an IFF.

      cheers, Paul

    • #2276242

      Here’s what you want …  IIF(GetUserInfo()<=7,Rep,GetUserInfo())

      Jim

      1 user thanked author for this post.
    • #2276249

      Our Access teacher told us, that IIF is just normal IF, but it has to named otherwise not to colide with other IF function.

      iif

      Also, beware of the “wildcard symbol”. Since you work in access, * should be right, but maybe there should be just single quotation (alt+39) instead of double.
      https://www.w3schools.com/sql/sql_like.asp


      @jimatVirginiaSoftware
      solution seems viable.

      Dell Latitude 3420, Intel Core i7 @ 2.8 GHz, 16GB RAM, W10 22H2 Enterprise

      HAL3000, AMD Athlon 200GE @ 3,4 GHz, 8GB RAM, Fedora 29

      PRUSA i3 MK3S+

    • #2276379

      Jim was right: IIf(GetUserInfo()<=7,([Rep]),GetUserInfo()) did the trick.

    Viewing 4 reply threads
    Reply To: filtering a query with IIf statement problem

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: