I have a table of data in Access 97 containing lots of records with different towns. I don’t want to create a query for each town, so how can I extract data depending on the particular town I want?

This is best down using what’s called an Access ‘parameter query’. When it’s setup and run, the query will prompt you for the particular town you want . The town is typed in and the query then extracts the data based on that town. The next time you run the query, it prompts you again, another town can be entered, and the new data is extracted.

This is how to set it up:

  1. With the database task list showing, click the Queries tab and click the New button.

  2. Leave Design View selected, then click OK.

  3. Select the table you want to add to the query list, then click the Add button. You can add other tables if you want to combine data from different tables, but we’ll leave it at that so click the Close button.

  4. Double-click the fields you wish to see in the final query result, which adds them to the query columns, and double-click the Town field.

  5. Now we’ll enter the parameter query codes. Click inside the Criteria section under the field you want to query on, which in this case is Town.

  6. Type the text [Which town do you want?] with the square brackets. The square brackets tell Access to display the dialogue box to enter the data you want to query when the query is run. The text between the square brackets is the message displayed in the dialogue box.

  7. If the column is too narrow, double-click the mouse here:
    Size query column.

    Your screen should look something like this:
    Parameter query.

  8. Click the Save button to save the query, enter a name, such as Town Query, then click OK.

  9. When you double-click the query to run it, the message Which town do you want? appears in a dialogue box.
    Parameter query prompt.

  10. Type the town you want, exactly as it would appear in the actual data, then click OK. The extracted data then appears.

Unfortunately, you can’t use wild cards in a parameter query. Entering W* in the dialogue box, for example, will not extract Wodonga, Walwa, Walla, and so on. The asterisk, *, is seen as an actual text character.

Add to Technorati Favorites


// Related Posted - GOOGLE!

Loading



Related Websites
Saturday, May 10th, 2008 at 14:02
No comments yet.

Leave a comment

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>