Presentation is loading. Please wait.

Presentation is loading. Please wait.

Access Queries and Forms. Access Queries Simple Queries  To create an Access query, don’t use the query wizard. Instead, create query in Design view.

Similar presentations


Presentation on theme: "Access Queries and Forms. Access Queries Simple Queries  To create an Access query, don’t use the query wizard. Instead, create query in Design view."— Presentation transcript:

1 Access Queries and Forms

2 Access Queries

3 Simple Queries  To create an Access query, don’t use the query wizard. Instead, create query in Design view  Let’s see how Access does it  Copy the Pets database to your desktop  Then open the Pets database

4 Queries  You can look for something after a certain date IF the data was stored as date/time and you say >1/1/2004  Dates should be entered with # before and after the date, and can be in many different formats, ie #1/1/2004#, #January 1, 2004#, #1-Jan-2004#

5 Queries  Logical OR - You can look for records in the state of Indiana or Illinois by saying “IL” OR “IN”  You can also say: In (“IL”, “IN”, “OH”)  Logical AND - you can make multiple entries in the query boxes. For example, in the State field enter “IL” and then in the Size field enter <3

6 Queries  Logical AND - You can also use an AND in one field. For example, in the Size field you can enter >=3 AND <=9  A slightly easier way of doing this is using the BETWEEN operator: Between 3 and 9  Possible operators include =, <>,, =

7 Queries That Calculate  When performing a query, you can aggregate the data  You can perform a Count, Sum, Avg, Max, Min, StDev, Var(iance), First, and Last  Count, First, and Last can be performed on types counter, number, currency, date/time, yes/no, text, memo, and OLE object  The others on counter, number, currency, date/time, and yes/no

8 Example  Say you have a database for a vet that treats dogs. Each dog treated has an entry including ID, weight, and height  If you want to find the average weight and height of all pets: (you may have to click on View / Totals) Field: Pet IDWeightHeight Total: CountAvgAvg Show: X X X

9 Example  What if you want to find the average height and weight for all dogs? Field: WeightHeightType of Animal Total: AvgAvgGroup By Show: X X X Criteria:“Dog”

10 Example  What if you want to find the minimum and maximum weight for all dogs? Field: WeightWeightType of Animal Total: MinMaxGroup By Show: X X X Criteria:“Dog”

11

12  One way to start a form is to use the Form Wizard  Let’s create a form for our Real Estate database, for the Listings table  Download the Real Estate database to the desktop and unzip the file

13  Now go back into Design View to edit the form  Resize windows  Move fields around  Many more properties / controls available

14  Label controls – headings, labels, captions, instructions  Text box controls – data is displayed or entered here  Toggle buttons, option / radio buttons, check boxes  Option group – contains multiple toggle buttons

15  List box – a pull down menu which is always down  Combo box – a pull down menu which you must pull down, and also lets you add an option that is not on the list  When working with forms, notice Table button (or Field List), Toolbox button, and Wizard button in Toolbox

16  Let’s try another example  Create a form using Name text 50, Married Yes/No, Employed Yes/No, Home Owner Yes/No, City text 50, and State text 2  Make Name a text box, Married a toggle button, Employed a check box, Home Owner an option button, City a combo box, and State a list box

17  Click on Field List button. If you can’t click on this, click on Properties and set Record Source to appropriate table  Click on Toolbox and make sure Wizard button is pressed  Click on ab|, then click and drag on Name field  Click on Toggle button, then click and drag on Married field  Now put a caption or a picture in the toggle button using Properties

18  Pretty much everything in Access has a list of properties associated with it  To display properties, you can click on View  Properties from the menu bar  Or you can right click on an item  Let’s look at some properties

19  Create form for main table  On toolbox, click on subform button (make sure the Wizard button is pressed)  Answer the wizard’s questions

20  Note – if you change the data on the form, you are changing it in the database!  You can use the form for entering new data  You can create a form for a query and if you enter new data on the query form, it changes the data in the table!  Let’s stop here and try our activity


Download ppt "Access Queries and Forms. Access Queries Simple Queries  To create an Access query, don’t use the query wizard. Instead, create query in Design view."

Similar presentations


Ads by Google