How to display certain things in a ListBox

Unified

Registered User.
Local time
Today, 11:34
Joined
Aug 26, 2004
Messages
18
Ok, on my form i have a ListBox that displays all the data in the table called Beams. The Beams Table contains fields named IDNum, Color, Length of Job, Cost, Cost Charged and Count. I want to be able to enter a color name (Ex. Burnt Umber) into a TextBox and have it list all the records where that color was used. How would i set the TextBox/ListBox up to run this way? Any help givin would be greatly appreciated.
 
here's something that may help ;)

i had a similar problem 2hrs ago and i found it in the sample downloads.


try it and let me know if its similar to what you want to be able to do.
if it is you could just follow the structure that it has and modify it according to your database.
 

Attachments

Actually that is a near perfect example of what i want, of course with a little bit of tweaking. But I can't seem to get either the TextBox or the ListBox to work properly. The coding is pretty much the same as in the example you provided.. but it still doesn't work. I have a feeling that it's the coding in the ListBox part that is hanging it up.. but anyways..

Code for TextBox:

Private Sub tbSearch_Change()
Dim vSearchString As String

vSearchString = tbSearch.Text
tbSearch2.Value = vSearchString
Me.QuickSearch.Requery
End Sub

Code for ListBox:

Private Sub QuickSearch_AfterUpdate()

Dim db As DAO.Database
Dim rs As DAO.Recordset

Set rs = Me.Recordset.Clone
rs.FindFirst "[ID] = " & Str(Me![QuickSearch])
Me.Bookmark = rs.Bookmark
End Sub

The part that I think is messed up is in the rs.FindFirst "[ID] = " & Str(Me![QuickSearch]) line. I'm not exactly what i should have put in the underlined portion. In the Search example you uploaded it has 'CompanyID', but since i didnt have CompanyID, i just put in ID for the field i do have.
 

Users who are viewing this thread

Back
Top Bottom