How to Remove ADO RecordSet from a ListBox

dunagh

Registered User.
Local time
Yesterday, 23:06
Joined
Apr 16, 2013
Messages
17
How do you Remove ADO RecordSet from a ListBox?

How does one go about removing a recordset from a ListBox?

I have a list box that I want to toggle between using a query and an ADO RecordSet to populate the values.

Once I set the listbox .RecordSet property to the ADO.Recordset, I can't remove the values displayed in the listbox when I assign a query to the .RowSource property.

I suppose I can turn the .RowSource query to an ADO Query but I am being lazy and don't want to rewrite the query as a T-SQL query.

Any thoughts?

EDIT: I previously thought the list box was pulling data from the .RowSource query but I realize I was wrong.
 
Last edited:
Figured it out. I am sure it was a no brainer but I forgot about the 'Nothing' keyword. I was trying to set the .RecordSet property to null which was throwing errors.

Code:
Set listbox.RecordSet = Nothing
 

Users who are viewing this thread

Back
Top Bottom