Thanks to much appreciated help from DKenny I now have a Word (2003) userfrom that loads values into comboboxes depending on a previous selection.

In some instances, this will result in some comboboxes having only one choice. In these instances I want to lock the combobox and change the backcolor. I have managed to lock, but can't change the backcolor - I receive an invalid qualifier message when testing.

Also, I'm sure I can shorten/improve the code because some of the items choices in cboChassisMake lead to the same results. For example, "DAF" "ERF" and "Foden" - Any ideas would be appreciated (I did try using OR but kept receiving errors). Here's the code.

VB Code:
  1. With Me.cboGearboxMake
  2.         'First remove existing values from cboGearboxMake
  3.         .Clear
  4.         If Me.cboChassisMake.Value = "DAF" Then
  5.             'Add the appropriate items for DAF
  6.             .AddItem "Eaton"
  7.             .AddItem "ZF"
  8.             'Select standard gearbox
  9.             .ListIndex = 1
  10.         ElseIf Me.cboChassisMake.Value = "ERF" Then
  11.             'Add the appropriate items for DAF, ERF and Foden
  12.             .AddItem "Eaton"
  13.             .AddItem "ZF"
  14.             'Select standard gearbox
  15.             .ListIndex = 1
  16.         ElseIf Me.cboChassisMake.Value = "Foden" Then
  17.             'Add the appropriate items for Foden
  18.             .AddItem "Eaton"
  19.             .AddItem "ZF"
  20.             'Select standard gearbox
  21.             .ListIndex = 1
  22.         ElseIf Me.cboChassisMake.Value = "Iveco" Then
  23.             'Add the appropriate items for Iveco
  24.             .AddItem "ZF"
  25.             'Select standard gearbox
  26.             .ListIndex = 0
  27.         ElseIf Me.cboChassisMake.Value = "MAN" Then
  28.             'Add the appropriate items for MAN
  29.             .AddItem "ZF"
  30.             'Select standard gearbox
  31.             .ListIndex = 0
  32.         ElseIf Me.cboChassisMake.Value = "Mercedes" Then
  33.             'Add the appropriate items for Mercedes
  34.             .AddItem "Mercedes"
  35. [VBCODE[COLOR=Red]].BackColor.RGB = RGB(123, 123, 123)[/[/COLOR]VBCODE]
  36.             .Locked = True
  37.             'Select the standard gearbox
  38.             .ListIndex = 0
  39.         ElseIf Me.cboChassisMake.Value = "Renault" Then
  40.             'Add the appropriate items for Renault
  41.             .AddItem "ZF"
  42.             'Select the standard gearbox
  43.             .ListIndex = 0
  44.         ElseIf Me.cboChassisMake.Value = "Scania" Then
  45.             'Add the appropriate items for Scania
  46.             .AddItem "Scania"
  47.             'Select the standard gearbox
  48.             .ListIndex = 0
  49.         ElseIf Me.cboChassisMake.Value = "Volvo" Then
  50.             'Add the appropriate items for Volvo
  51.             .AddItem "Volvo"
  52.             'Select the standard gearbox
  53.             .ListIndex = 0
  54.         Else
  55.             'Add all items
  56.             .AddItem "Eaton"
  57.             .AddItem "Mercedes"
  58.             .AddItem "Scania"
  59.             .AddItem "Volvo"
  60.             .AddItem "ZF"
  61.         End If
  62.        
  63.     End With
  64.    
  65. End Sub