L
Lenny
I am creating a Word '03 Form template with fields.
There are 10 items in the dropdown (combobox).
The user enters a number in a "quantity" field, then tabs to the next field
which is the combobox dropdown. Upon selection of an item from the list, the
code
populates a third field with a predefined (in SelectCase) number and a
fourth field executes a calculation based on the quantity entered and the
defined SelectCase number. The calculations work fine when run with the form
in locked down mode (protected).
The first 5 items listed in the combobox appear and calculate properly...
however, the combo box contents for items 6-9 appear correctly, but the
predefined number is not appearing, ergo, no calculation for items 6-9 in the
list.
Please see attached form and module code below: can anyone tell me why only
the first five items in the combobox list are appearing and calculating
correctly?
(There is a combobox for each line of the form, sample below)
Private Sub ComboBox2_Change()
ActiveDocument.FormFields("Item_Description1").Result = ComboBox2.Value
End Sub
------------------------------------------------------------------------------------------------
Private Sub UserForm_Initialize()
ComboBox2.ColumnCount = 1
'Load data into ComboBox
ComboBox2.List() = Array("Technical Data on CD", _
"Technical Manuals (hardcopy)", _
"Technical Manuals on CD", _
"Publications on CD", _
"Drawings on CD", _
"Drawings (hardcopy)", _
"T-Shirts (Cotton) - Mens", _
"T-Shirts (Cotton) - Womens", _
"Coffee Mug (Plastic)", _
"Other - Type Here")
End Sub
-----------------------------------------------------------------------------------------------
Private Sub Cmdclose_Click()
Unload Me
End Sub
------------------------------------------------------------------------------------------------
(There is a module for each combobox in the form)
Sub ItemValues6()
Dim oDoc As Document
Dim sigName As String
Set oDoc = ActiveDocument
sigName = oDoc.FormFields("Item_Description6").Result
Select Case sigName
Case "Technical Data on CD"
oDoc.FormFields("UnitValue6").Result = "1.00"
Case "Technical Manuals (hardcopy)"
oDoc.FormFields("UnitValue6").Result = "5.00"
Case "Technical Manuals on CD"
oDoc.FormFields("UnitValue6").Result = "1.00"
Case "Publications on CD"
oDoc.FormFields("UnitValue6").Result = "1.00"
Case "Drawings on CD"
oDoc.FormFields("UnitValue6").Result = "1.00"
Case "Drawings on Hardcopy"
oDoc.FormFields("UnitValue6").Result = "10.00"
Case "T-Shirts (Cotton) - Men"
oDoc.FormFields("UnitValue6").Result = "10.00"
Case "T-Shirts (Cotton) - Women"
oDoc.FormFields("UnitValue6").Result = "10.00"
Case "Coffee Mug (Plastic)"
oDoc.FormFields("UnitValue6").Result = "2.00"
End Select
End Sub
There are 10 items in the dropdown (combobox).
The user enters a number in a "quantity" field, then tabs to the next field
which is the combobox dropdown. Upon selection of an item from the list, the
code
populates a third field with a predefined (in SelectCase) number and a
fourth field executes a calculation based on the quantity entered and the
defined SelectCase number. The calculations work fine when run with the form
in locked down mode (protected).
The first 5 items listed in the combobox appear and calculate properly...
however, the combo box contents for items 6-9 appear correctly, but the
predefined number is not appearing, ergo, no calculation for items 6-9 in the
list.
Please see attached form and module code below: can anyone tell me why only
the first five items in the combobox list are appearing and calculating
correctly?
(There is a combobox for each line of the form, sample below)
Private Sub ComboBox2_Change()
ActiveDocument.FormFields("Item_Description1").Result = ComboBox2.Value
End Sub
------------------------------------------------------------------------------------------------
Private Sub UserForm_Initialize()
ComboBox2.ColumnCount = 1
'Load data into ComboBox
ComboBox2.List() = Array("Technical Data on CD", _
"Technical Manuals (hardcopy)", _
"Technical Manuals on CD", _
"Publications on CD", _
"Drawings on CD", _
"Drawings (hardcopy)", _
"T-Shirts (Cotton) - Mens", _
"T-Shirts (Cotton) - Womens", _
"Coffee Mug (Plastic)", _
"Other - Type Here")
End Sub
-----------------------------------------------------------------------------------------------
Private Sub Cmdclose_Click()
Unload Me
End Sub
------------------------------------------------------------------------------------------------
(There is a module for each combobox in the form)
Sub ItemValues6()
Dim oDoc As Document
Dim sigName As String
Set oDoc = ActiveDocument
sigName = oDoc.FormFields("Item_Description6").Result
Select Case sigName
Case "Technical Data on CD"
oDoc.FormFields("UnitValue6").Result = "1.00"
Case "Technical Manuals (hardcopy)"
oDoc.FormFields("UnitValue6").Result = "5.00"
Case "Technical Manuals on CD"
oDoc.FormFields("UnitValue6").Result = "1.00"
Case "Publications on CD"
oDoc.FormFields("UnitValue6").Result = "1.00"
Case "Drawings on CD"
oDoc.FormFields("UnitValue6").Result = "1.00"
Case "Drawings on Hardcopy"
oDoc.FormFields("UnitValue6").Result = "10.00"
Case "T-Shirts (Cotton) - Men"
oDoc.FormFields("UnitValue6").Result = "10.00"
Case "T-Shirts (Cotton) - Women"
oDoc.FormFields("UnitValue6").Result = "10.00"
Case "Coffee Mug (Plastic)"
oDoc.FormFields("UnitValue6").Result = "2.00"
End Select
End Sub