Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 09-05-2012, 09:23 AM
coconutt coconutt is offline Dropdown selection value Windows XP Dropdown selection value Office 2007
Novice
Dropdown selection value
 
Join Date: May 2012
Posts: 10
coconutt is on a distinguished road
Default 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?
Reply With Quote
  #2  
Old 09-06-2012, 03:35 AM
macropod's Avatar
macropod macropod is offline Dropdown selection value Windows 7 64bit Dropdown selection value Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

What kind of dropdown (eg formfield, content control, userform)?
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #3  
Old 09-06-2012, 06:53 AM
coconutt coconutt is offline Dropdown selection value Windows XP Dropdown selection value Office 2007
Novice
Dropdown selection value
 
Join Date: May 2012
Posts: 10
coconutt is on a distinguished road
Default

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.
Reply With Quote
  #4  
Old 09-06-2012, 03:53 PM
macropod's Avatar
macropod macropod is offline Dropdown selection value Windows 7 64bit Dropdown selection value Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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]
Reply With Quote
  #5  
Old 09-13-2012, 01:08 PM
coconutt coconutt is offline Dropdown selection value Windows XP Dropdown selection value Office 2007
Novice
Dropdown selection value
 
Join Date: May 2012
Posts: 10
coconutt is on a distinguished road
Default 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
Attached Files
File Type: zip BarcodeGenTm.zip (19.0 KB, 20 views)
Reply With Quote
  #6  
Old 09-13-2012, 05:23 PM
macropod's Avatar
macropod macropod is offline Dropdown selection value Windows 7 64bit Dropdown selection value Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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
Then, with your 'cmdOK_Click' sub, you can call these via:
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]
Reply With Quote
Reply

Tags
combo box, dropdown, forms, vba

Thread Tools
Display Modes


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
Dropdown selection value 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

Other Forums: Access Forums

All times are GMT -7. The time now is 03:18 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft