additem


Posted by phishfn on July 05, 2001 5:53 PM

Can someone tell me why this code gives me the error "Statements and labels invalid between Select Case and first Case". It highlights the "Private Sub Userfform_Initialize" with the yellow arrow and highlights (selects) the first ".AddItem". I just want to put values in a combobox on a form I made:

Private Sub UserForm_Initialize()
Select Case cboSType.Value
cboSType.AddItem " " '0
cboSType.AddItem "CG/OG With Cold Bar" '1
cboSType.AddItem "CG/OG Without Cold Bar" '2
cboSType.AddItem "Image With Cold Bar" '3
cboSType.AddItem "Image Without Cold Bar" '4
End Select
Select Case cboSOpen.Value
cboSOpen.AddItem " " '0
cboSOpen.AddItem "8:00 AM" '1
cboSOpen.AddItem "9:00 AM" '2
cboSOpen.AddItem "10:00 AM" '3
cboSOpen.AddItem "11:00 AM" '4
cboSOpen.AddItem "12:00 PM" '5
End Select
End Sub


Thanks
phishfn



Posted by Russell on July 05, 2001 6:06 PM

You don't need a select case statement with your code. Select Case is like If-ElseIf-ElseIF-ElseIf....

Just take out the Select Case statement

cboSType.AddItem " " '0
cboSType.AddItem "CG/OG With Cold Bar" '1
cboSType.AddItem "CG/OG Without Cold Bar" '2
cboSType.AddItem "Image With Cold Bar" '3
cboSType.AddItem "Image Without Cold Bar" '4

Not sure what your goal is though....

Hope this helps,

Russell