This document provides step-by-step instructions for setting up a basic customer database in Microsoft Access 2007. It describes how to create a new blank database, set up a table, define fields and field properties, add validation rules, and use a drop-down list for data entry.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
49 views8 pages
Ms Access Walkthrough1
This document provides step-by-step instructions for setting up a basic customer database in Microsoft Access 2007. It describes how to create a new blank database, set up a table, define fields and field properties, add validation rules, and use a drop-down list for data entry.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8
www.teach-ict.
com All Rights Reserved
1
Setting up a basic database in Access 2007
1. Open Access. This is the screen that you should see
2. Click on Blank database
3. Enter the name customer mailing list in the file name section (this will only appear after you have clicked on blank database)
Choose a folder to save your new database into by clicking on the folder icon
Click the create button
You have now set up a new database which at the moment contains no data or records
4. Now you need to start setting up your first table. Single click on Table 1:Table to select it
You are going to set up your table in design view
Go to view and from the drop-down list select design view
You will be asked to save your table and give it a name. Call it customers
Click ok
www.teach-ict.com All Rights Reserved 2 You should now be able to work on your table in design view. It should look something like this
5. Now you are going to set up your fields. Enter the field names as shown here
6. You might have noticed that the data type for most of the fields has defaulted to text.
The data type controls what type of data can be entered into a field. Here are some examples of data types you might use:
Text Stores letters, numbers and symbols Number Used to store numbers, both positive, negative and decimals Date / Time Used to store dates and times Currency Used to store anything related to prices or money Yes / No Gives just two options yes and no
Think about what will be stored in each field. Try to complete the table below.
Field name Example of data stored Data type Title Mr, Text First Name J ohn Text Surname Doe Address Line 1 23 High Street Address Line 2 Little Big Village Town Best Town Postcode AB12 3CD Home Phone 01234 567890 Email johndoe@myemail.com Gender Male Date of Birth 01/01/65 Children Yes
www.teach-ict.com All Rights Reserved 3 This is what you should have come up with: Field name Example of data stored Data type Title Mr, Text First Name J ohn Text Surname Doe Text Address Line 1 23 High Street Text Address Line 2 Little Big Village Text Town Best Town Text Postcode AB12 3CD Text Home Phone 01234 567890 Text Email johndoe@myemail.com Text Gender Male Text Date of Birth 01/01/65 Date/Time Children Yes Yes/No
Phone number You probably got most of them right with the exception of Home Phone. Most people are likely to have chosen number and at first glance that would seem sensible. However, phone numbers should ALWAYS be stored as text.
Why? Because all phone numbers start with a 0 and if you store them as a number data type it will automatically drop the leading 0. Think about how you write numbers, you would put 234 not 0234.
The second reason is that data stored as a number might have calculations performed on it such as adding, multiplying etc. There is no reason whatsoever for ever wanting to add phone numbers together.
So, remember, phone numbers are always stored as text.
CustomerID The only field we havent mentioned is customerID.
If you have a look to the left of the name customer ID you will notice a small key symbol. This means that this field is set as the primary key.
A primary key is a field within a database which ensures that every record can be uniquely identified. This is important because every record in a database must have something to uniquely identify it. Think about school, you all have a unique student number. If you have a bank account you have a unique bank account number.
Now you can choose your own unique identifier for each record. Think about the Argos store, they have thousands of items all with their own product code to identify them. Argos had to make sure that each code was unique.
However, for your database you dont need to do this, you can use the data type autonumber.
Autonumber means each time you create a new record i.e. add a new customer to the database, the autonumber data type will ensure that the customerID is given a new, unique number. So it will start at 1 and then the next record you add will be given the next unique number, i.e. 2 and so on.
www.teach-ict.com All Rights Reserved 4 Now you know what the different data types for your fields should be you can change them in your database table.
Make sure you are in the data type column, next to the correct field name and click your mouse.
An arrow will appear which opens up a drop-down box with all of the available data types
Your fields and data types should look like this
7. Access automatically gives each Text data type field a maximum number of 255 characters that can be entered.
This can be seen if you click onto one of the text fields in your table. The field size will be shown in the field properties section
None of your fields are going to have anything close to 255 characters entered. The title field stores Mr, Mrs, Miss or Ms, so this field really only needs a maximum of 4 spaces allowed. First name is unlikely to be more than 12 characters.
It is a good idea to make the field size smaller. This is because for every character space allowed one byte of storage is taken up. So a field size of 255 will take up 255 bytes of storage but in reality you might only be using up 5 of those character spaces.
Your database is small so it probably doesnt matter much, but in large scale databases it is very important to change the field size so that expensive storage isnt wasted and also the database doesnt become slow to search.
You are going to change the field size for your text fields only (not number, date/time, yes/no or any other data type)
Click into the field called title and the field size box will appear. Click into the field size where it has defaulted to 255 characters and change it to 4.
www.teach-ict.com All Rights Reserved 5 Click into all your other Text fields and think of the most letters you are likely to need for that field. Then change the Field size number to something more appropriate.
8. Save your database table
9. You are going to put some validation into your database.
Validation provides a set of rules that are checked when you try to enter data into your table. If the data you entered breaks one of the rules then it will not allow you to continue and will probably give you an error message. For example, if you know that none of your customers is likely to have been born before 1920 then you could put a rule that checks the date of birth you entered is always after 1920. If you enter 1918 you will get an error message.
There are different types of validation rules and we will have a look at setting up a few of them.
Range check Click onto the date of birth field
In the field properties section, click into validation rule
You use the same symbols from maths:
> greater than < less than = equal to
In the validation rule box type >01/01/1920 and press your enter key.
Access will automatically put #symbols in the correct place for you.
This means that you can only enter dates after 01/01/1920.
BUT, what if you wanted to enter 01/01/1920. At the moment the validation rule would stop you because only dates after this are allowed. Try amending the rule using the maths symbols above.
You have your rule in place and if you enter something wrong then you wont now be allowed to continue until you change it. However, if this was the first time you had seen the database you might not know that there was a validation rule in place and you certainly wouldnt know what it was. So, it is important to provide an error message to tell the user what they have done wrong and how to correct their mistake.
In the validation text section enter a suitable error message, for example Please check that the year of birth entered is not before 1920
www.teach-ict.com All Rights Reserved 6 10. Now try setting up a validation rule on the gender field that will only allow you to enter M or F.
When you press your enter key, Access will add speech marks in the correct places.
Write an appropriate error message
11. Sometimes it is very important that you do not forget to enter data into a field it might be a problem if you want to contact your customers and find that you dont have their name or address stored.
We are going to make e-mail a required field i.e. you will always be required to enter data into this field you cannot leave it blank.
Click into the field called e-mail
Go to the field properties section
Look for Required at the moment it defaults to no.
Click into Required and an arrow will appear. Choose Yes.
Now, you cannot leave this field blank when you come to enter data.
12. Some things you will find that you type in over and over again. This is a pain as it takes a lot of time to do, and there is the risk that one time you might make a mistake and enter Mis instead of Miss.
You are going to set up a drop down list that will give you a list of options for title
Click into the data type area of title field
The drop down box will appear. This time, choose look up wizard
www.teach-ict.com All Rights Reserved 7
This box will appear.
Choose I will type in the values that I want
Click Next
Type in a list of the titles that you want to use
Click to go to the next row. If you press enter it will take you to the next screen. If this happens just press the back button.
Click Next again and then click Finish
You cant see this list until you start entering your data in datasheet view but it is there.
Save your table.
13. You have set up your table and now you are going to enter a few records into it.
Click on the arrow underneath view
Choose datasheet view. This is the view that you use to enter data directly into the table.
This is what your table should now look like
Dont enter anything into the CustomerID field. The autonumber data type will automatically give it a new number when you start the first record. J ust tab across to the title field.
Enter data for one customer.
You should see your drop-down box in the title field.
In the gender field you should only be able to enter M or F try something else and check you get your error message.
www.teach-ict.com All Rights Reserved 8
You should not be able to leave the email field blank give it a go and see what happens.
Try entering a date of birth before 1920 and see what happens.
14. Enter at least five records into your table (make up the data).
You may: Guide teachers or students to access this resource from the teach-ict.com site Print out enough copies to use during the lesson
You may not: Adapt or build on this work Save this resource to a school network or VLE Republish this resource on the internet
A subscription will enable you to access an editable version, without the watermark and save it on your protected network or VLE