1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Solved: Drop Down fields and secondary field display/selection

Discussion in 'Business Applications' started by Cooker2k, Mar 16, 2015.

Thread Status:
Not open for further replies.
Advertisement
  1. Cooker2k

    Cooker2k Thread Starter

    Joined:
    Mar 9, 2015
    Messages:
    12
    I am making a data entry form in Access 2010 and I am a beginner. One of the fields I am to build has a dropdown (which I have done), but there is a secondary field which should display an outcome based on that drop down.
    As an example: in the dropdown are the choices: assets, volume, credit production.

    • When you pick the metric "assets" from the drop down, it should display a field to enter the amount.
    • When you pick "credit production", it should display another dropdown field where the user picks either +1 or -1 and another field called "account number" which is a free form entry field.
    Another example where another field depends on the first drop down choice: Drop Down #1: The drop down choices are: Governance Committee, exception, recovery. Drop Down #2 which explains who approved: There are 4 names and then "governance". If they select "governance committee", it is supposed to auto fill with governance.


    Can you help coach me through this?
     
  2. Keebellah

    Keebellah Trusted Advisor

    Joined:
    Mar 27, 2008
    Messages:
    6,608
    First Name:
    Hans
    Hi, welcome to the forum.
    How about telling us whcih application? You know, to let peolple guess is not the best way to get the right information :)
    When you mention the application, please include version.
     
  3. Cooker2k

    Cooker2k Thread Starter

    Joined:
    Mar 9, 2015
    Messages:
    12
    Oops! Access 2010. I updated my original post.
     
  4. Keebellah

    Keebellah Trusted Advisor

    Joined:
    Mar 27, 2008
    Messages:
    6,608
    First Name:
    Hans
    Okay, thakns, I'm sure an Access expert will pick it up. :)
     
  5. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    Hello Tam, when you say "but there is a secondary field which should display an outcome based on that drop down. £
    How are you trying to achieve this?
    For instance do those fields actually exist yet?

    To make a current field appear or disappear based on the Drop Dowm (Combo) selection takes VBA code in the Combo field's After Update Event Procedure.
     
  6. Cooker2k

    Cooker2k Thread Starter

    Joined:
    Mar 9, 2015
    Messages:
    12
    Hi. Yes, those fields actually exist in the table. The requirement was to only show the user the fields they need based on their selection.
     
  7. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    To assist you with the VBA code I would need to know the exact names of the fields that go with each choice.
     
  8. Cooker2k

    Cooker2k Thread Starter

    Joined:
    Mar 9, 2015
    Messages:
    12
    No VBA code exists.


    Field in the table is called "Metric" We want to count which metrics are used the most. So, the user can select one (and only one) of the following values from a drop-down:
    Assets
    Cash
    Volume
    Other


    Other fields in the table exists where the user inputs the values for the above choices. There is a "Cash" field, "volume" field, "assets" field and "other" field.


    We want a 1:1 entry for what was selected in the drop down to the value entered in the field. The goal is when they select Assets, they cannot populate the other fields. When they select "cash", they cannot populate the other fields...etc.
     
  9. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    Ok, you can either make the fields not to be used Invisible or you can "Disable" them
    In the Metric field's After Update Event Procedure you need to copy the following code.

    on error goto errorcatch ' this line will take you to an error description should one occur

    If me.Metric = "Assets" then
    me.Cash.enabled = false
    me.Volume.enabled = false
    me.Other.enabled = false
    end if
    If me.Metric = "Cash" then
    me.Assets.enabled = false
    me.Volume.enabled = false
    me.Other.enabled = false
    end if
    If me.Metric = "Volume" then
    me.Cash.enabled = false
    me.Assets.enabled = false
    me.Other.enabled = false
    end if
    If me.Other = "Assets" then
    me.Cash.enabled = false
    me.Volume.enabled = false
    me.Assets.enabled = false
    end if

    exit sub
    errorcatch:
    MsgBox Err.Description
     
  10. Cooker2k

    Cooker2k Thread Starter

    Joined:
    Mar 9, 2015
    Messages:
    12
    This worked great! Thank you!
     
  11. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/1144863

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice