SunQuest
 
           Visual Basic Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Iron Speed
Go Back   ASP Free ForumsProgrammingVisual Basic Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
SlickEdit: Code in over 40 languages across 7 platforms. SlickEdit’s unmatched power, speed, and flexibility allows even the most accomplished developers to write better code faster. Download a free trial today!
  #1  
Old July 15th, 2004, 04:22 AM
KevinRedfern KevinRedfern is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Jul 2004
Posts: 7 KevinRedfern User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Exclamation Filtering Listbox

What i have is the following code. I have only got three control, data listbox and textbox.

From the data control i fill the list box with a list of phone number from an access mdb file. The field is set to general text.

I want the user to use the text box to see if a number appears in the listbox.

What i am struggling to do is the get the list box to filter.

I have pasted my code below, can anybodu help me.


Option Explicit
Private GR As Recordset
Private R As Recordset
Private Sub Form_Activate()
Static b As Boolean
If Not b Then
Set GR = Data1.Recordset
GR.Filter = "Phone1 Like '*" & Text1.Text & "*'"
Set R = GR.OpenRecordset(dbOpenDynaset)
LoadList
b = True
End If
End Sub
Sub LoadList()
List1.Clear
If R.RecordCount > 0 Then
R.MoveFirst
Do Until R.EOF
List1.AddItem R!phone1
R.MoveNext
Loop
End If
End Sub
Private Sub Text1_Change()
GR.Filter = "phone1 Like '*" & Text1.Text & "*'"
Set R = GR.OpenRecordset(dbOpenDynaset)
LoadList
End Sub

Reply With Quote
Reply

Viewing: ASP Free ForumsProgrammingVisual Basic Programming > Filtering Listbox


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway