28.06.2015 Views

Microsoft-Access Tutorial

Microsoft-Access Tutorial

Microsoft-Access Tutorial

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

You can remove the key property again by once more<br />

selecting Primary Key. If the key consists of more than<br />

one field, you first select all the fields by clicking on<br />

their left-hand marker with Ctrl down. Then select<br />

Primary Key by right-clicking inside one of the field<br />

lines.<br />

7. Close the window. <strong>Access</strong> asks you for the name<br />

of the table. Call it tblGuest. (The prefix tbl will<br />

help you remember that it is a table. As the system<br />

grows, there will be guest windows, guest buttons<br />

and many other things. Without discipline on your<br />

part, it becomes a mess.)<br />

If you have not defined a primary key, <strong>Access</strong> will<br />

warn you and suggest that it makes one for you. Don't<br />

let it - do it yourself. Or at least check what <strong>Access</strong><br />

makes in its excessive helpfulness.<br />

Enter data<br />

After these efforts, it is time to record some guests.<br />

Fortunately it is easy:<br />

8. Select the guest table in the database window.<br />

Click Open or just use Enter.<br />

Now the system shows the table in user mode (Datasheet<br />

view) so that you can enter guest data.<br />

9. Enter the guests shown on Figure 2.1C. You add a<br />

new guest in the empty line of the table - the one<br />

marked with a star. Notice that as soon you start<br />

entering something, the record indicator changes to<br />

a pencil and a new star line appears. The pencil<br />

shows that you are editing the record, and the<br />

record you see is not yet in the database.<br />

On Figure 2.1C we originally entered a guest that got<br />

guestID 4, later deleted this guest. <strong>Access</strong> will never<br />

reuse number 4 for a guest.<br />

Close and reopen the database<br />

To feel confident with <strong>Access</strong>, it is a good idea to close<br />

and open the database now.<br />

10. Close the large <strong>Access</strong> window. (Not the small<br />

database window inside the <strong>Access</strong> window.)<br />

Notice that <strong>Access</strong> doesn't ask whether you want to<br />

save changes. <strong>Access</strong> saves them all along, for instance<br />

when you define a table or when you enter a record in<br />

the table.<br />

11. Find your database file (hotel.mdb) in the file folders.<br />

Use Enter or double click to open it.<br />

<strong>Access</strong> 2003 is very security concerned and asks you<br />

several questions when you open the file. The dialog<br />

may vary from one installation to another, but is<br />

something like this:<br />

12. The file may not be safe. Do you want to open it?<br />

Your database is safe, so answer Open.<br />

13. Unsafe expressions are not blocked. Do you want<br />

to block them? You want full freedom, so answer<br />

No.<br />

14. <strong>Access</strong> warns you one more time whether you<br />

want to open. Say Open or Yes. (In some versions<br />

the question is a very long text box, and you<br />

cannot understand it. Say yes anyway.)<br />

As an alternative, you may say yes to blocking the<br />

unsafe expressions. This will save you some questions<br />

when you open the file in the future. However, some<br />

installations don't allow you to block expressions.<br />

Note that <strong>Access</strong> 2003 shows that your database is in<br />

<strong>Access</strong> 2000 format. This is all right. It allows you to<br />

use it also from <strong>Access</strong> 2000. You can convert it to<br />

other formats with Tools -> Database Utilities -> Convert<br />

Database.<br />

Undo. Use Esc to undo the changes you have made to<br />

the current record.<br />

• The first Esc undoes changes to the field where the<br />

cursor is.<br />

• The second Esc undoes all changes to the record<br />

where the cursor is.<br />

As soon as you move the cursor to the next line,<br />

<strong>Access</strong> stores the record in the database and you cannot<br />

make an automatic undo anymore. However, you can<br />

manually edit the stored record. Notice that the pencil<br />

disappears when the record is stored in the database.<br />

Shortcut keys for data entry<br />

F2: Toggles between selecting the entire field and selecting<br />

a data entry point.<br />

Shift+F2: Opens a small window with space for the<br />

entire field. Useful for entering long texts into a<br />

field that is shown only partly in the table. However,<br />

the text cannot be longer than you specified in<br />

the table definition.<br />

Alt+ArrowDown: Opens a combo box. Choose with<br />

the arrows and Enter.<br />

Shortcut keys for navigation<br />

Tab and Shift+Tab: Moves from field to field.<br />

Ctrl+Tab: Moves from one tab form to the next, for instance<br />

in the lower part of the table definition window.<br />

F6: Moves between upper and lower section of a window,<br />

for instance in the table definition window.<br />

Ctrl+Enter: Opens the table in design mode (in the database<br />

window).<br />

See also shortcuts on the reference card<br />

8 2. Creating a database

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!