Results 1 to 3 of 3
  1. #1
    kadoss is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Mar 2017
    Posts
    4

    What will this code return with the following criteria?

    Came across some code that someone else has written and don't have a good way to test it at the moment.


    Just looking at this bit of it, what do you guys think the below code return if the LoanT = 1 AND the ReportingT = 9? Federal or Gin?

    CASEWHEN L.LoanT= '1' THEN 'Federal'
    WHEN L.LoanT = '2' THEN 'Veterans'
    WHEN L.LoanT > '2' THEN 'Other'
    WHEN Inv.ReportingT IN (1,9) THEN 'Gin'
    WHEN Inv.ReportingT = 0 OR Inv.InvID = 'REO/F' THEN'Fred'
    WHEN Inv.ReportingTy IN (6,7,8) AND Inv.InvID <>'REO/N' THEN 'Privates'
    ELSE 'Fan' END AS InvTyp,

  2. #2
    Ajax is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    8,953
    You have this thread in modules, whereas the code is TSQL, so on the basis this is actual a sql server question since the condition is met first with LoanT, I would expect it to return 'Federal'.

    However you are comparing

    L.LoanT= '1' (i.e. text)

    and

    if the LoanT = 1 (a number)

    so perhaps nothing at all

  3. #3
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    21,701
    FYI, I moved the thread to SQL Server. I'd concur with Federal, as the function will return the result of the first condition met (I'd also concur with the text/number thoughts).
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 5
    Last Post: 02-13-2016, 10:12 AM
  2. Replies: 1
    Last Post: 05-13-2015, 02:17 AM
  3. Report Code is not allowing return to main code
    By rcwiley in forum Programming
    Replies: 2
    Last Post: 06-16-2013, 10:31 AM
  4. How do I return a value on multi criteria?
    By smc678 in forum Access
    Replies: 5
    Last Post: 11-20-2012, 02:35 PM
  5. Dlookup to match two criteria and return value
    By randolphoralph in forum Programming
    Replies: 20
    Last Post: 05-20-2010, 12:27 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 - Senior Forums