How to get Started Using Microsoft Access Even if You've Never Used it Before by Paul Barnett - HTML preview

PLEASE NOTE: This is an HTML preview only and some elements such as links or page numbers may be incorrect.
Download the book in PDF, ePub, Kindle for a complete version.

CREATE A QUERY

We can use a query to get different views of data. Go back to the database window and select the ‘Query’ tab. Click the ‘New’ button and select ‘Design View’. 00055.jpgYou will now see a list of tables we created earlier.

 

00056.jpgSelect each table and click the ‘Add’ button.

 

Each table will appear in the query designer. Click the ‘Close’ button when you are done.

You will notice that the tables are linked via CustomerID. This is because once again Access recognises fields with identical names and assumes it is the primary and foreign key.

00057.jpg

In the customers table double click the FirstName and LastName fields. You will notice these fields appear in the grid. Double click the OrderDate, ProductNumber and Price fields from the Sales table. These will also appear in the grid.

Click the Run button at the top menu

00058.jpg

Depending on the number of records you added to the system you will see something similar to the following:

00059.jpgWe can see for example that John Smith made 3 purchases.

 

Although this gives us a quick overview we can also get a more useful picture by grouping data.

 

Click the design button

 

00060.jpgon the menu. This takes us back to the query designer.

 

Remove the OrderDate field by clicking the bar above the name until the column highlights.

 

00061.jpgNow press the ‘Delete’ key on your keyboard

 

Do the same with the ‘Product Number’ field

You should now be left with a display as follows:

00062.jpg

We now want to group the names and sum so that we can get an overall total for each person.

On the menu bar click the grouping button

 

00063.jpgYour grid will now show

 

00064.jpgWe can see that all fields now have a grouping. We want to sum the ‘Price’ column though so click into the ‘Total’ box for the price and change it’s Group By to Sum.

 

You should now have

 

00065.jpgNow click the Run button

 

00066.jpgon the top menu

 

We can now see that the data has been grouped for each person and we get a running total of what they have purchased.

 

00067.jpgIf you only want to see totals for individuals you can do this also.

 

Go back to the design view of the query and enter the first and last name into the grid.

 

00068.jpgYou don’t need to enter the quotation marks as MS Access will automatically do this.

 

Click the ‘Run’ button and you should see and individual total record

 

00069.jpgIf you now save your query you can create a report based on it. Queries are a very powerful feature of MS Access and are great for reports.

 

I hope I have given you some useful tips on how to get started with MS Access and what can be achieved. I cover things in greater detail in further ebooks and videos.

 

Access is a very powerful database tool and one that can take your business forward.