Thread: [Solved] Dropdown selection value
View Single Post
 
Old 09-13-2012, 05:23 PM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
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