I am working on a form in my application for a Worker Profile evrything is working fine except the Search Box. I have to be able to search on two criteria. One is the WorkStatus i.e. Active, Inactive,etc. and 1 of three other choices. First Name, Last Name or SSN. I have pIaced 4 unbound text boxes on my form tied to the select query that pulls all the records called Work Add/Edit Query. I can run with the status and it works fine but how do I include one of my other criteria with that? As soon as I add another criteria to my query it doesn't work. I am stumped. Doug
Form Search Engine - Please help
Collapse
X
-
I am working on a form in my application for a Worker Profile evrything is working fine except the Search Box. I have to be able to search on two criteria. One is the WorkStatus i.e. Active, Inactive,etc. and 1 of three other choices. First Name, Last Name or SSN. I have pIaced 4 unbound text boxes on my form tied to the select query that pulls all the records called Work Add/Edit Query. I can run with the status and it works fine but how do I include one of my other criteria with that? As soon as I add another criteria to my query it doesn't work. I am stumped. Doug
See if this can help guide you:
[CODE=VB]
Set my_database = OpenDatabase("C :\DataGram\Data _Central.mdb")
'this function will open your database in access (provided that it is closed access)
Set my_record = my_database.Ope nRecordset("SEL ECT * FROM LIBRARY WHERE Your_Price LIKE '" & Text1(0).Text & "' OR Name LIKE'" & Text1(1).Text & "'")
' above is used to search by price and/ or name, only if data already exist
'you can also add AND there to fit your needs...
Do While Not my_record.EOF 'this function will keep searching for fields matching each textbox
Text1(0).Text = my_record.field s("Your_Price ")
Text1(1).Text = my_record.field s("Name")
Text1(2).Text = my_record.field s("Type")
Text1(3).Text = my_record.field s("Crime_Rate_1 ")
Text1(4).Text = my_record.field s("Crime_Rate_2 ")
[/CODE]
Post your code if this isn't it, but above runs here looking for price for appartments and name depending on similarity.
Hope this helps! -
Comment