Solved: Drop Down fields and secondary field display/selection

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

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?
 

Keebellah

Hans
Trusted Advisor
Joined
Mar 27, 2008
Messages
6,639
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.
 

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.
 

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.
 

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.
 

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.
 

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
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

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 807,865 other people just like you!

Latest posts

Members online

Top