In Access 2007, how to combine between with IIf

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • InkaYes
    New Member
    • Jan 2014
    • 2

    In Access 2007, how to combine between with IIf

    Hallo everybody, I need help pls.

    In this project I've got query [q_Check_CHILDRE N_NUM_vs_YIZKOR _2013] based on few tables:
    1- with 73703 unique IDs [All_IDs2],
    2- names of people that belongs to this ID's [t_FNs_RESULT],
    3- status of these people [t_STATUS_RESULT], & so on.

    Which in the end includes 7 specific IDs (rows) in which I intresteed.

    For further examination, I need to see in front of me not only these IDs, but also one (or two) before & one (or two) after these IDs.

    As I understood it, I should use between function... So I take & join the [All_IDs2] in one to many connection to the query [q_Check_CHILDRE N_NUM_vs_YIZKOR _2013]. Suppose to be:

    Code:
    Between ([q_Check_CHILDREN_NUM_vs_YIZKOR_2013].[ID]-1)
    And ([q_Check_CHILDREN_NUM_vs_YIZKOR_2013].[ID]+1)
    But it doesn't work, 'couse in the line before & after it's null (only 7 IDs).

    So I need to combine it somehow with:

    Code:
    IIf([q_Check_CHILDREN_NUM_vs_YIZKOR_2013].[ID]= Null, [All_IDs2].[ID])
    But it gives me a warning about mismatch in expression...
    Someone please can give me another, better option, that works?

    Actually I already made it by some heavy & really not elegant way, but I really want to know if there's some other way.
    Last edited by zmbd; Jan 29 '14, 12:41 PM. Reason: [Z{Please use the [CODE/] button to format posted script and formated text - Please read the FAQ}{Also, fixed some grammer, used ":" where needed, added some whitespace - run-ons are hard on
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32662

    #2
    It sounds like you're hoping to get 7 different sets of data where each set is the identified record as well as the ones immediately before and after it.

    Unless I read you wrong though, the ones before and after the selected ones are not, actually, numerically adjacent.

    The code you (half) post seems to be working on the basis that they are adjacent. If so, then it is not just slightly wrong, but completely wrong in as much as neither it, nor even any derivative of it (Forget handling nulls as that's not even relevant.), could possibly work.

    If I've understood you correctly then this is not a problem I can answer even. Sorry.

    If I've misunderstood you then I suggest you make your question more clear. I say this in the full appreciation that you already appear to have put some effort into formulating the question in the first place. Well done for that.

    Comment

    • InkaYes
      New Member
      • Jan 2014
      • 2

      #3
      Thank you NeoPa, you're not misunderstood me :)

      Comment

      Working...