Compile error

J

Juli Intern

I'm trying to run following code and it gives me a compile error of
"Method or data member not found" and highlight
List1.Clear. Can someone tell me where can I find method or data member?
I have Form_load sub that previously load recordset into the list, and then
I'm trying to search in it using folloing sub.
Would be very thankful
Thanks.


Private Sub Command1_click()
Dim List0 As ComboBox
Dim SQLQuery As String
List0.Clear
SQLQuery = "Date LIKE '*" & Text1 & "*'"
myrs.FindFirst SQLQuery
If myrs.NoMatch = True Then Exit Sub
List0.AddItem myrs.Fields("date")
Do Until myrs.NoMatch = True
myrs.FindNext SQLQuery
List0.AddItem myrs.Fields("Date")
Loop

End Sub
 
S

Stuart McCall

List0.Clear will work in VB but not Access. When you use the AddItem method
of a combo or listbox, Access actually writes the values into the RowSource
property, separated by semi-colons (known as a 'value list'). So all you
need to do to clear the list is:

List0.RowSource = ""
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top