Results 1 to 4 of 4

Thread: If value in report combobox A, B or C, then another combo box d or e.
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    New Member
    Join Date
    Dec 2010
    Posts
    33
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default If value in report combobox A, B or C, then another combo box d or e.

    Good day all,

    I have a simple issue that I am struggling to resolve. In an access report I have a combobox (Called "InterestCode") that looks up a value from a query and outputs that value. There are a number of options , eg. M1, M2, M3, P1, P2 etc.

    Depending on this value, I would like another combobox on the same report to show either "Dividend" or "Interest". E.g. if M1, M2 or M3, then "Dividend", if P1, P2, then "Interest".

    I am sure there is a simple way to do this via the data tab in the property sheet, however I cannot figure it out.

    Can someone kindly assist?
    Last edited by rowbro; Jun 10th, 2019 at 02:09 PM.

  2. #2
    MrExcel MVP
    Moderator
    xenou's Avatar
    Join Date
    Mar 2007
    Location
    Clev. OH, USA
    Posts
    16,362
    Post Thanks / Like
    Mentioned
    10 Post(s)
    Tagged
    1 Thread(s)

    Default Re: If value in report combobox A, B or C, then another combo box d or e.

    this might work:

    Code:
    =IIF(Left([InterestCode],1) = "M","Dividend", IIF(Left([InterestCode],1) = "P", "Interest"), "")
    But I'm not sure what happens if nothing is selected (null? blank? Error?). And of course it is limited to things that start with M or P. A DLookup on interest codes would be more robust if you have that data in a table.

    Using: Office 2010/Win7 (work) Office 2010/Win7 (home)

    You are rich in proportion to the number of things you can let alone.
    -- Henry David Thoreau

  3. #3
    New Member
    Join Date
    Dec 2010
    Posts
    33
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: If value in report combobox A, B or C, then another combo box d or e.

    Thanks, this is helpful. The only issue is that there are a distinct set of codes that could be "interest" or"dividend" and they don't all start with the same letter (sorry, poor example I gave).

    I think it best if I either define them (about 20 in total) or set up a table as you suggest and do a Dlookup.

  4. #4
    MrExcel MVP
    Moderator
    xenou's Avatar
    Join Date
    Mar 2007
    Location
    Clev. OH, USA
    Posts
    16,362
    Post Thanks / Like
    Mentioned
    10 Post(s)
    Tagged
    1 Thread(s)

    Default Re: If value in report combobox A, B or C, then another combo box d or e.

    Okay. You could put a long in () clause in the formula I guess. But dlookup would be cleaner.

    Using: Office 2010/Win7 (work) Office 2010/Win7 (home)

    You are rich in proportion to the number of things you can let alone.
    -- Henry David Thoreau

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •