Discussion Locked

Microsoft Access 97 (or higher)

0 helpful
13 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

I have a simple CD database that has the following fields:
CD ID (unique)
CD Title
Access Code
Owner

I would like to know how to have a report list all the items a user searched for, for example, if I enter [Type Title to Search] under the CDTitle field (in query) this will find only items trped that match in Title. How can I have the user type their request and ALL FIELD get quiried at the same time, in other words, I would type 'TEST', all CD ID's, CD Titles, Access Codes and Owner would find the word TEST and report that record(s). Let me know if I need to elaborate more.

Thank you

13 replies

by otl

Use the query wizard to create a form to find any part of the field that matches the users requested string. Add a menu item to allow them to searce on a specific field. Can also create a Match that if result = '0' then search for *.*.

by parier

Most DB's I encounter have forms set up already and I was swondering if there was a query that I can setup that will query all fields, then I can kust make a button and have the data land on a form. The whole idea is to have FOUND records appear ona form...

by shanghai sam

If I understand your question correctly, you want to let the user enter a search STRING and then retrieve in a specific table of your db all records where any TEXT field matches that pattern (in fact, I see no reason why you would search 'TEST' in, for example, the CD ID field).

If this is the scenario, you can build a simple form where the user input the string, and then a query that matches all the text fields with that string (using AND/OR depending on your requirements). For example, youcan use the following Criteria:

Like "*" & Forms![MySearchForm]![StringToSearch] & "*"

Where MySearchForm is the name of the form and StringToSearch is the name of the text box where the user enters the search string.

Also refer to the Access Help: it really is a useful tool.

HTH.

Alessandro

by parier

Reason for test, you never know what the user will be searching for, this time it was test, next time they may have a blank CD case with a number 11 on it and want to search for 10 (CD ID field.

by archimede

If I understand your question correctly, you want to let the user enter a search STRING and then retrieve in a specific table of your db all records where any TEXT field matches that pattern (in fact, I see no reason why you would search 'TEST' in, for example, the CD ID field).

If this is the scenario, you can build a simple form where the user input the string, and then a query that matches all the text fields with that string (using AND/OR depending on your requirements). For example, youcan use the following Criteria:

Like "*" & Forms![MySearchForm]![StringToSearch] & "*"

Where MySearchForm is the name of the form and StringToSearch is the name of the text box where the user enters the search string.

Also refer to the Access Help: it really is a useful tool.

HTH.

Alessandro

by sl-campbell

This is pretty simple. Use the form wizard to get started. Create a basic single column form, selecting as the source the table in question (CD).
Once the form is created and opens, click on the designer icon (or VIEW|DESIGN menu). If the properties window isn't already open then click on VIEW|PROPERTIES (make sure the property window is for the Form itsself - if not then click on the dropdown on the toolbar and select "Form") and the on the DATA tab. To the right of DataSource is an arrow andan icon with 3 dots. Click on the 3 dots - the query designer will open. You will see a small window and a grid. The small window is the table and inside it are the fields - either double click on each field so that they appear in the grid, or double click the table window header so that all fields are marked and then click and drag the fields all at once onto the grid.
The last thing do do is add criteria:
On the "Criteria" line under the first field type in something like: [Search criteria]- don't forget the brackets.
Copy this - [Search criteria] - and paste it under EACH field name, on the NEXT criteria line stepping down a line as you go to each field - if they are all pasted onto the same line then you will have 0 results returned because the criteria will use "AND" instead of "OR" for each field search.

Then close the query designer, save, and open the form in form view. You only have to enter the criteria once, but the search will return records found in ANY field that matches the entered query.

by sl-campbell

How about letting us know what the status on this is? I have been tracking this long enough now....

This discussion is closed to new replies.