Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Clearing a listbox 1

Status
Not open for further replies.

ehicks727

Programmer
Oct 26, 2004
36
US
Hello, I'm trying to clear a listbox when the user unchecks a checkbox. It populates just fine when there's a check in the box, but I can't get the list box to clear when there is no check in the box. What happens is that whatever populated when it was check stays there when it's unchecked... nothing changes.

Code:
Private Sub chkLimitGrp_AfterUpdate()
    'MsgBox chkLimitGrp
    If chkLimitGrp = True Then
        'MsgBox "populating listbox"
        Me![lstGroups].RowSource = "SELECT DISTINCT rpt_cust_name FROM tbllob ORDER BY rpt_cust_name;"
        Me![lstGroups].Requery
    Else
        MsgBox "clearing listbox"
        Me![lstStates].RowSource = "SELECT rpt_cust_name FROM tbllob WHERE 1 = 2;"
        Me![lstStates].Requery
        Me.Refresh
    End If
End Sub

I've tried this (as suggested in other threads) as well and nothing.

Me![lstStates].RowSource = ""

Any help would be appreciated. Thanks.
 
Are you aware that the code shows lstGroups in the 'If chkLimitGrp = True' part and lstStates in the 'Else' part?
 
HA! I'm retarded... thanks for being my second set of eyes. :)
 
good catch Remou


Jeff Bridgham
Purdue University
Graduate School
Data Analyst
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top