[Lecture 3] Getting Started & Creating A Table in MS Access
The database window is the hub of Access. It contains all the objects you will create
and use in your system. For example tables, forms, queries, macros etc. If you need
to create a new form go to the database window, click the forms tab and select new
form. To bring the database window back into view at any time press your F11 key.
CREATING A TABLE
Add your first field and give it a name. It is advisable to make the first field and ID or
identifier field. You will see why later, but essentially it is used to link other tables to
Give the field a name – In this case I have used the name CustomerID. I tend to
name my fields using no spaces between the words
Select the data type. For ID fields it is recommended to use auto number as the data
type. The auto number data type will increment your ID by one each time a record is
added and saves you having to do this yourself.
John Smith ID = 1
Kate Wilson ID = 2
Joe Bloggs ID = 3
It is also advisable to make an ID field have a Primary Key. This means that the field
is unique and will have a unique ID. To do this right click the field name and select
‘Primary Key’ from the menu.
I will now add in additional fields.
I have used text as the data type for some fields and they have a length of 50. You
can adjust this if you require by clicking on the field name and looking at the
properties that appear. For example:
I am calling it tblCustomer. It is a good idea to prefix tables with the letters ‘tbl’. We
can do the same with queries and use ‘qry’ or for forms use ‘frm’.
You now have a customers table to store information.
You could open the table and add records in this fashion if you choose.
At the database window right click the table name and select ‘Open’
Try typing in the CustomerID field. You will notice that you cannot type in anything
there. The reason for this is you set that field to be an Auto number field. It is only MS
Access itself that can change values in that field.
Move the cursor along to the other fields and you will find you can type something in.
Adding data in this way is fine, but it is not very user friendly or visual. A better way is
to use a form.
Last edited by Їийоcёйт Кїllєґ; 05-29-2011 at 01:14 AM.
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)