Results 1 to 2 of 2
2001-03-08, 13:41 #1swilsonGuest
I have a piece of VBScript which generates an array from a database, containing 4 fields. I use another bit of VBScript to fill a dropdown list. The problem is that when I select an item from the list, I want to assign values to three hidden fields based on the corresponding array elements. I can't get the right syntax to add to the 'onChange' command.
e.g. array contains (1,A,1A,A1/2,B,2B,B2/3,C,3C,C3) If I choose the 2nd item from the dropdown list (1,2,3), then H1, H2 & H3 will contain B, 2B & B2 respectively.
2001-03-11, 17:47 #2
- Join Date
- Feb 2001
- Silicon Valley, USA
- Thanked 94 Times in 90 Posts
Being trained as an economist, I'm going to assume that you have the value 1, 2, or 3 from your drown-down control. Let's call that value varSelection, which we hope is a Variant of sub-type integer or long. (If it is a double or single, you might want to convert it to CInt before doing the below.)
You could write something like this:
H1 = myArray((varSelection * 3) - 2)
H2 = myarray((varSelection * 3) - 1)
H3 = myArray(varSelection * 3)
This should fill your fields with the right values.