#1
|
|||
|
|||
Dropdown selection value
Hello, I am trying to figure out a way for a user to select a value from a dropdown, but after selection it needs to have a numerical value. For instance, user selects ekg from dropdown1 and the value to dispaly is 60. Any thoughts? |
#2
|
||||
|
||||
What kind of dropdown (eg formfield, content control, userform)?
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
The project can have any of the above mentioned. I envision a form that the user selects from combo-box or list-box the desired category ex (EKG) and its numerical value is used elsewhere, for this form it will b used for a bar-code.
|
#4
|
||||
|
||||
To the extent that it might be possible with any of them (and I doubt it's possible with formfields), vba coding would be required and the code for each would be quite different. It's not something I'd be inclined to undertake unless (a) there is a pressing need to not have both the selection and the corresponding value show (with formfields, this can all be done via field coding without resorting to vba); and (b) a specific application requiring it was being considered.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
|||
|
|||
Userform Dropdown
I have a form a user enters in data and click ok event puts on word document. My question is how can I give that data a numerical value?
Thanks |
#6
|
||||
|
||||
With your initialisation, you could add the values, so:
Code:
Private Sub UserForm_Initialize() cmbCat.AddItem "HHP" 'ListIndex = 0 cmbCat.Column(1, 0) = 1234 cmbCat.AddItem "Demographics" 'ListIndex = 1 cmbCat.Column(1, 1) = 2345 cmbCat.AddItem "Immunization" 'ListIndex = 2 cmbCat.Column(1, 2) = 3456 cmbCat.AddItem "History and Physical" 'ListIndex = 3 cmbCat.Column(1, 3) = 4567 cmbCat.AddItem "Progress Note" 'ListIndex = 4 cmbCat.Column(1, 4) = 5678 cmbCat.AddItem "Labs" 'ListIndex = 5 cmbCat.Column(1, 5) = 6789 cmbCat.AddItem "Xray" 'ListIndex = 6 cmbCat.Column(1, 6) = 7890 cmbCat.AddItem "EKG" 'ListIndex = 7 cmbCat.Column(1, 7) = 8901 cmbCat.AddItem "Physician Orders" 'ListIndex = 8 cmbCat.Column(1, 8) = 9012 cmbCat.AddItem "Consults" 'ListIndex = 9 cmbCat.Column(1, 9) = 2468 cmbCat.AddItem "Misc" 'ListIndex = 10 cmbCat.Column(1, 10) = 4810 cmbCat.AddItem "RX" 'ListIndex = 11 cmbCat.Column(1, 11) = 1012 cmbCat.AddItem "Encounters" 'ListIndex = 12 cmbCat.Column(1, 12) = 1248 cmbCat.AddItem "HHP" 'ListIndex = 13 cmbCat.Column(1, 13) = 1357 'Using drop down list cmbCat.Style = fmStyleDropDownList ' ComboBox valuers are List Index Values cmbCat.BoundColumn = 0 ' setting cmbCat to first entry cmbCat.ListIndex = 0 End Sub vCat = UserForm1.cmbCat.Column(1) Do note that, in many barcoding systems (eg code 128), you can't simply take an alpha/numeric string and apply the barcode font to it - you must first transform the entire string via a compression code and it's the compressed code that gets barcoded. Accordingly, outputting each variable into separate formfields won't work for such systems. It may be OK for Code 3of9, though, but even that requires asterisks at each end.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
Tags |
combo box, dropdown, forms, vba |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
add values to dropdown selections and calculate | guyhs | Word | 7 | 10-24-2012 05:11 PM |
Autofill a form which is contingent on a dropdown selection. | biffle0764 | Word | 2 | 05-09-2012 12:54 PM |
Macro to populate a text form field based on dropdown selection | koloa | Word | 0 | 10-20-2011 11:52 AM |
Automatic find replace after selection in dropdown | vsempoux | Word | 0 | 10-28-2009 08:45 AM |
Validating Dropdown box | dammad83 | Word VBA | 0 | 03-01-2006 12:40 PM |