PC Review


Reply
Thread Tools Rate Thread

combo box list error

 
 
=?Utf-8?B?ZXJuaWU=?=
Guest
Posts: n/a
 
      14th Jun 2007
Hi All,

I need help with this code. i need to be able to remove the combobox list
before i add a new one.

Private Sub ValidateUnit()
If Application.WorksheetFunction.Clean(Trim(cboStation)) = "" Then
Label143.Visible = False
Label144.Visible = False
cboUnit.Visible = False
Else
Label143.Visible = True
Label144.Visible = True
cboUnit.Visible = True
'specify unit list
Select Case Application.WorksheetFunction.Clean(Trim(cboStation))
Case "00R0"
With cboUnit
.AddItem "Warehousing"
.AddItem "Valuation"
End With
Case "00P0"
With cboUnit
.AddItem "Office"
.AddItem "Shed"
End With
Case "00CA"
With cboUnit
.AddItem "Office"
End With
Case "00MH"
With cboUnit
.AddItem "Office"
End With
Case "00AN"
With cboUnit
.AddItem "Office"
End With
Case Else
'Do Nothing
End Select
End If
End Sub

I tried adding the code below but i get this an error message "Compile
error: Argument not optional"

If cboUnit.Visible = True Then
With cboUnit
.RemoveItem.ListIndex
End With
End If

Thanks

 
Reply With Quote
 
 
 
 
=?Utf-8?B?ZXJuaWU=?=
Guest
Posts: n/a
 
      14th Jun 2007
ok i solved my own problem. i use the .clear before .additem. thanks anyways
With cboUnit
.Clear
.AddItem "Office"
End With


"ernie" wrote:

> Hi All,
>
> I need help with this code. i need to be able to remove the combobox list
> before i add a new one.
>
> Private Sub ValidateUnit()
> If Application.WorksheetFunction.Clean(Trim(cboStation)) = "" Then
> Label143.Visible = False
> Label144.Visible = False
> cboUnit.Visible = False
> Else
> Label143.Visible = True
> Label144.Visible = True
> cboUnit.Visible = True
> 'specify unit list
> Select Case Application.WorksheetFunction.Clean(Trim(cboStation))
> Case "00R0"
> With cboUnit
> .AddItem "Warehousing"
> .AddItem "Valuation"
> End With
> Case "00P0"
> With cboUnit
> .AddItem "Office"
> .AddItem "Shed"
> End With
> Case "00CA"
> With cboUnit
> .AddItem "Office"
> End With
> Case "00MH"
> With cboUnit
> .AddItem "Office"
> End With
> Case "00AN"
> With cboUnit
> .AddItem "Office"
> End With
> Case Else
> 'Do Nothing
> End Select
> End If
> End Sub
>
> I tried adding the code below but i get this an error message "Compile
> error: Argument not optional"
>
> If cboUnit.Visible = True Then
> With cboUnit
> .RemoveItem.ListIndex
> End With
> End If
>
> Thanks
>

 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
limit the contents of one combo/list box based on what's selected inanother combo/list box CDF Microsoft Access 11 7th Mar 2009 03:23 PM
Combo Box, List Box and Error 424 David Wetmore Microsoft Access Form Coding 5 2nd Apr 2008 08:12 PM
Combo Box Adding to List--Error 91 =?Utf-8?B?bWF1cmE=?= Microsoft Access Form Coding 2 2nd May 2007 06:17 PM
Combo Box list error =?Utf-8?B?TWU=?= Microsoft Access Form Coding 3 19th Apr 2006 04:19 AM
Combo Box List out of range error. =?Utf-8?B?S2lyYW4=?= Microsoft Excel Misc 3 6th Jul 2005 01:27 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:47 PM.