Search form including a drop down box, keywords and a serach button

D

Donna Grant

I'm trying to create a custom search box in MS Access 97. I'd like
there to be a drop down list of all the fields, and then a text box
for the user to enter their keyword. Alongside there would be a 'Go'
button which would run the search for the keyword in the selected
field...

I know I will have to create a form with a combo box, a text box and
then SQL query but I'm not sure how to put it all together.

Please help
 
S

Steve Ward

First of all, give everything a name. (The form, the text
box, combo box and button).

Now, create a query in query builder that shows all the
fields you want to show, but also has a WHERE clause that
looks for the value in your drop down box and text box to
get the field nams and criteria (instead of hardcoding).

Save and name this query (eg query1)

Then, add an event to the on click of your button which is

docmd.openquery(query1)

OR... you could have another form which instead of being
linked to a table is linked to the query and it will then
display the results in text boxes.

Hope this points you in the right Direction
 

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