Wednesday, March 30, 2011

ADDING BUTTONS TO FORMS

Im just posting this on the blog because i think this is important and i will be constantly referring ot it so i thought it would be good if it was on my blog :)

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 using design view.
  2. Click on the Control Wizard tool.
  3. Click the Command Button tool.
  4. Click on the form where you want the button to appear.
  5. The window shown below will appear. Select Miscellaneous and Run Query as shown. Click next.
  6. Select the appropriate query (you have to have made a query before hand). Click next.
  7. Label the button by selecting the text option. Click next.
  8. Name the button command then click finish.
  9. While still in design view create labels for your form using the Aa tool.
  10. You can colour the background by simply right clicking on it and choosing Fill/Back Colour.
  11. Resize and position the queries as required then click save to have them permanently appear in that position each time the button is clicked.

Querying a database


Questions:
What sort of information has the query selected:
All the products with a unit price of $10

Enter another value in the criteria row of the cost column.
I entered 15


What sort of information has this second query selected?
All the products with a unit price of $15



Design the following queries and describe the type of information they are selecting.

This query allows us to look at all products and their unit prices that have a reorder level of 10. (as you can see from below)



< this query enables us to look at products and their reorder levels with the units in stock ascending (as you can see below:)

Basic database: Tables




Tables store data, so they're essential building blocks of any database.
A database should have a separate table for every major subject, such as employee records, customer orders, shipping methods, or suppliers. Data should not be duplicated in multiple tables. Duplicating data is a common error, but it's easy to avoid if you structure your tables well.
Each table contains rows called records and columns called fields.



The fields in your database have settings that determine the type of data they can store, how the data is displayed, and what you can do with the data.One important setting for fields is the data type, including number, text, currency (money), and date/time (shown together as one type in Access). Fields also have properties that control the details of information inside them, including a character length, a default value, and a validation rule that makes sure the data meets certain criteria.



To distinguish one record from another, tables can contain a primary key field. A primary key separates similar information and makes each record unique. It also brings information together. You relate one table to another using a primary key. This is how tables share data, and how you can avoid repeating information in both the tables. When tables relate, the primary key of one table becomes a foreign key of the other table.