Tuesday, March 13, 2012

Creating a Parameter Query

Create a query using the Design View.

In query Design view, drag the fields from the field list to the query design grid.

In the Criteria cell for each field you want to use as a parameter, type an expression with a prompt enclosed in square brackets. To prompt the user for one or more characters to search for, and then find records that begin with or contain the characters the user specifies, create a parameter query that uses the LIKE operator and the wildcard symbol (*).


For example, the following statement searches for words that begin with a specified letter:

LIKE [Enter the first character to search by: ] & "*"
 
 

Result:

The following  statement searches for words that contain the specified character:
LIKE "*" & [Enter any character to search by: ] & "*"
 
 
 
 
 
 
 
 
 
Results:
 

Adding a Button to a form

Buttons can be used to control database functions in this case we will create a button to open a query. Open a database that has a query in it then;

  1. Create a form (use the “create” tab then select the form wizard).
  2. Once the form is created, ensure you are in design view then click the design tab.



    Click the Button tool. Click on the form where you want the button to appear.
    The window shown below will appear. Select “Miscellaneous” and “Run Query” as shown. Click next.
    Select the appropriate query (you have to have made a query before hand). Click next.
    Select either a text of picture button (what ever is more appropriate)


    Label the button by selecting the text option. Click next.

     

    Name the button command then click finish.
    1. While still in design view create labels for your form using the Aa tool.
    2. You can colour the background by simply right clicking on it and choosing Fill/Back Colour.
    3. Resize and position the queries as required then click save to have them permanently appear in that position each time the button is clicked.

    Finished Form with Buttons