473,395 Members | 1,968 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Text Box Conditional

38
All -

I have one box tha is a drop down with numeric values. I have a second textbox that has a percentage value. I'm trying to set a condition based on the first dropdown box that when the value changes, the second textbox will be updated with the appropriate value.

Dropdown - Textbox 'Class'
Values 0,1,2,3,4,5,6

Textbox 'Likeihood of sale'
Values 100,90,33,20,5,0,0


So when a user changes the dropdown value to say 4 then the percentage textbox value will be changed to 5%

Here is my sample code:If Me.Class = "0" Then
Me.Likelihood_of_Sale = "100"
End If

ElseIf Me.Class = "1" Then
Me.Likelihood_of_Sale = "90"
ElseIf Me.Class = "2" Then
Me.Likelihood_of_Sale = 33
ElseIf Me.Class = "3" Then
Me.Likelihood_of_Sale = 20
ElseIf Me.Class = "4" Then
Me.Likelihood_of_Sale = 0.05
ElseIf Me.Class = "5" Then
Me.Likelihood_of_Sale = 0
ElseIf Me.Class = "6" Then
Me.Likelihood_of_Sale = 0



Thanks for any help on this

-Dev1
Mar 17 '08 #1
1 1534
ADezii
8,834 Expert 8TB
All -

I have one box tha is a drop down with numeric values. I have a second textbox that has a percentage value. I'm trying to set a condition based on the first dropdown box that when the value changes, the second textbox will be updated with the appropriate value.

Dropdown - Textbox 'Class'
Values 0,1,2,3,4,5,6

Textbox 'Likeihood of sale'
Values 100,90,33,20,5,0,0

So when a user changes the dropdown value to say 4 then the percentage textbox value will be changed to 5%

Here is my sample code:If Me.Class = "0" Then
Me.Likelihood_of_Sale = "100"
End If

ElseIf Me.Class = "1" Then
Me.Likelihood_of_Sale = "90"
ElseIf Me.Class = "2" Then
Me.Likelihood_of_Sale = 33
ElseIf Me.Class = "3" Then
Me.Likelihood_of_Sale = 20
ElseIf Me.Class = "4" Then
Me.Likelihood_of_Sale = 0.05
ElseIf Me.Class = "5" Then
Me.Likelihood_of_Sale = 0
ElseIf Me.Class = "6" Then
Me.Likelihood_of_Sale = 0



Thanks for any help on this

-Dev1
Assuming your Combo Box name is cboNumericValues, then place the following code in the AfterUpdate() Event of this Combo Box, namely:
Expand|Select|Wrap|Line Numbers
  1. Private Sub cboNumericValues_AfterUpdate()
  2. Select Case Me![cboNumericValues]
  3.   Case 0
  4.     Me![Likelihood_of_Sale] = 100
  5.   Case 1
  6.     Me![Likelihood_of_Sale] = 90
  7.   Case 2
  8.     Me![Likelihood_of_Sale] = 33
  9.   Case 3
  10.     Me![Likelihood_of_Sale] = 20
  11.   Case 4
  12.     Me![Likelihood_of_Sale] = 0.05
  13.   Case 5, 6
  14.     Me![Likelihood_of_Sale] = 0
  15.   Case Else
  16.     Me![Likelihood_of_Sale] = Null
  17. End Select
  18. End Sub
Mar 18 '08 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

8
by: neblackcat | last post by:
Would anyone like to comment on the following idea? I was just going to offer it as a new PEP until it was suggested that I post it here for comment & consideration against PEP 308. I'm far...
1
by: David Winter | last post by:
(Sorry - couldn't find a generic DocBook NG - I hope this is close enough.) I'm considering moving my documentation and translation business - which is currently done in proprietary formats such...
27
by: C Gillespie | last post by:
Dear All, Hopefully I have a simple problem. Basically, I just want to alter some text with JS. Here is some of my test code: <snip> <script type="text/javascript"> var tmp='a';
28
by: Benjamin Niemann | last post by:
Hello, I've been just investigating IE conditional comments - hiding things from non-IE/Win browsers is easy, but I wanted to know, if it's possible to hide code from IE/Win browsers. I found...
2
by: John Kreps | last post by:
(acc 2002) I've got six unbound text boxes on a subform that has a white background. Each of those six boxes has an expression that when true, will change its background from white to another...
7
by: John Dolinka | last post by:
I have a project of several files with #defines to setup a conditional compile. I would like to put these #defines in a single file and change the conditional compile from this one file with the...
10
by: John Smith | last post by:
After reading C# documentation the Conditional attribute seemed the way to go, but after inspecting the IL it seems those methods are still there and I imagine the CLR removes them. Using #if DEBUG...
5
by: paulo | last post by:
Can anyone please tell me how the C language interprets the following code: #include <stdio.h> int main(void) { int a = 1; int b = 10; int x = 3;
1
by: littlealex | last post by:
IE6 not displaying text correctly - IE 7 & Firefox 3 are fine! Need some help with this as fairly new to CSS! In IE6 the text for the following page doesn't display properly - rather than being...
4
by: J Lagos | last post by:
I want to change the backcolor of textboxes in a report depending on their value. I messed with this for a few hours but I'm not savvy with the syntax for getting at controls in a report. can...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.