Search Text Box with Option Box as criteria for the search

hemolytucus

Registered User.
Local time
Tomorrow, 09:38
Joined
Feb 20, 2014
Messages
12
Hi

I am creating a a text box where the user enters a text then clicks an option from the option that is used as the criteria for the search e.g. Last Name, Phone , address then a command button wil run a query. is this possible? Any tips on how to do this.

Thanks
 
Lets call the text box tbSearch. You can set the criteria up as either a listbox or combo box - i would use combo box, lets call it cmbCriteria.

The code would be along the lines of:
Code:
SELECT {Fields} FROM {table} WHERE (" & cmbCriteira & " ='" & tbSearch & "';")

This assumes;

  • All the criteria fields come form the same table
  • The criteria are all text fields
 
so if I type the last name "cruz" and select last name on the combo box/ it will search all customer with cruz as their last name?
 
Yes, specifically cruz. for last names containing cruz
Code:
SELECT {Fields} FROM {table} WHERE (" & cmbCriteira & " LIKE *'" & tbSearch & "'*;")
 

Users who are viewing this thread

Back
Top Bottom