Locked lesson.
About this lesson
Make design changes to a form using Layout View.
Exercise files
Download this lesson’s related exercise files.
7.05 forms-in-layout-view-part2 - Exercise.docx55.1 KB 7.05 forms-in-layout-view-part2 - Exercise solution.docx
64 KB TechGurusTicketing17.accdb
792 KB TechGurusTicketing17 - Complete.accdb
800 KB
Quick reference
Forms in Layout View - Part 2
Use the Property Sheet to name fields and labels using the correct naming convention and protect the table by disabling fields.
When to use
We edit the properties of a field whenever we want to change the way the field looks and behaves.
Instructions
Editing Field Properties
We can edit any field in a table, simply by selecting it and adjusting the properties in the Property Sheet.
- Open up the Property Sheet for table 'frmTicketMaintenance'.
- Click on the ID field. Review the properties for this field.
- Click on the ID label. Review the properties for this label.
Labels in Access are given generic names, 'label1', 'label2' etc. This makes them difficult to identify so it's recommended that we rename these.
- In the Property Sheet, select the All tab.
- Change the label name to 'IDLabel'.
In general, text that will not be seen by users and exists solely in the database backend should have no spaces or the words should be separated with underscores.
- Click on the 'TicketNumber' label.
- Change the label name to 'TicketNumberLabel'.
- Rename all labels in the table.
The caption shows us how the label will display to the user.
- Click on the 'TicketNumber' label.
- Change the caption to 'Ticket Number'.
Protecting Fields
We may not always want every field in a table to be editable. This can be dangerous, particularly in terms of the ID field. We can effectively 'lock it down' by disabling access to the field.
- Select the 'ID' field.
- In the Property Sheet, change Enabled from Yes to No.
- Right-click on the tab and select Form View.
- Ensure that editing is now disabled for the 'ID' field.
Incomplete Records
- From the Record Selector, click New (blank) Record.
An ID will not be assigned to a new record until information is entered into another field. If we get partway through entering a record and want to undo, we need to press the ESC key.
Login to download- 00:04 In this lesson, we're going to continue working on our form in Layout View.
- 00:09 Now, one thing I did off camera between this lesson and
- 00:13 the last one was that I closed down the form that we were working on,
- 00:18 and I named it as form ticket maintenance.
- 00:21 So let's double click to reopen the form.
- 00:25 Now I'm going to go into Layout View again.
- 00:29 And we're going to bring up the property sheet for this form.
- 00:33 So let's click on Property Sheet.
- 00:35 And because I'm clicked on the ID field,
- 00:37 notice I'm currently looking at all of the properties specifically for that ID field.
- 00:43 So I can see that this ID field is a text box.
- 00:46 And then I have all of the different properties that I can change.
- 00:50 Now one thing to notice here, we have the name of the field and
- 00:54 then we have a label name.
- 00:56 And the label name is the very generic label 34.
- 00:59 And you'll notice this more if we click the drop down,
- 01:03 we have lots and lots of unnamed labels in here.
- 01:06 So what I would recommend that you do is that you go through and
- 01:09 give all of your labels meaningful names.
- 01:11 For example, if I click on this label just here,
- 01:14 I can see that is the technician label.
- 01:17 So I'm going to give this label a name of technician label so it's easy to identify.
- 01:24 So now when I click the drop down, I can see that there it is,
- 01:27 that's a lot more meaningful.
- 01:29 So I'm going to go through and rename all of these labels off camera, so
- 01:34 join me back here in a couple of moments.
- 01:36 So now I rename those labels, when I click that drop down,
- 01:39 notice that this looks a lot more meaningful.
- 01:42 It's much easier to identify which field it is that we're currently editing.
- 01:48 And I always like to do one last sweep through this list to make sure that I
- 01:52 don't have any other unnamed items.
- 01:55 So if I scroll through looks like pretty much everything is named.
- 01:57 I can see here text 39.
- 02:00 Let's click this, that's the ticket number.
- 02:03 So let's change this to ticket number.
- 02:08 Now the other thing that's important to know in this property
- 02:12 sheet is that the caption name is the actual label that user see.
- 02:16 So a lot of the time when I'm naming things like labels,
- 02:20 I won't put a space in between two words.
- 02:22 But I want the caption to show spaces because that's what it's going to look
- 02:26 like to use it.
- 02:28 So for example, if I click on the ticket number label just here,
- 02:32 notice that the caption in the Property Sheet doesn't have a space in the middle.
- 02:37 But I'm going to add one, like so.
- 02:40 And you can see that that is updated on the form.
- 02:43 So let's do the same for customer name, space, click away.
- 02:49 And then the only other one down here is date lot.
- 02:52 So let's click on the label and give that a space as well.
- 02:55 So that looks a lot more user friendly.
- 02:58 So that's my first piece of advice.
- 03:00 When you're designing forms, make sure that you go through, label everything,
- 03:05 so it's easy to identify and also make sure that your labels are user friendly.
- 03:10 Now I want to finish finish this lesson just by going back to a point I made last
- 03:14 lesson.
- 03:15 And that is, with the current way that we have this form set up, if we're working
- 03:20 in form view, any user can go in and make changes to any of these records.
- 03:24 And that has the potential to be really dangerous.
- 03:28 Particularly with this ID field at the top, that is such a crucial field,
- 03:32 it's our primary key.
- 03:34 We don't really want people being able to click here and
- 03:36 change this to something else because that could break our entire database.
- 03:40 So what you can do is basically lock different fields so
- 03:44 that nobody can edit them.
- 03:46 So we're going to lock or protect the ID field.
- 03:51 So for this, we're going to go back into Layout View,
- 03:54 make sure that you have the ID field selected.
- 03:57 And then over in the Property Sheet,
- 04:00 we're going to scroll down until we find find the enabled option.
- 04:05 Now notice that currently it's set to yes, so
- 04:08 we're going to double click to toggle that to no.
- 04:11 And there's a very small change that's occurred,
- 04:14 the field background has now turned to gray.
- 04:16 And if I try and click somewhere in that field to make any changes, I can't do it.
- 04:21 All of the other fields are still unlocked, but this one is now disabled.
- 04:25 So now if we switch back to Form View, notice that I can't edit that ID field,
- 04:31 but I can still edit every other field.
- 04:35 Now the final point to mention here,
- 04:37 if we use the record selector to add a new blank record, like so.
- 04:42 Notice that the ID number doesn't get assigned until you actually
- 04:46 enter information in your first field.
- 04:48 So I really need to add a ticket number in here before it's going to assign that ID.
- 04:55 Now, what about if you get partway through a record,
- 04:58 and you decide that you no longer want that record?
- 05:01 What we would need to do here is press the Escape key on our keyboard, and
- 05:06 that's going to remove all of that information from that new record.
Lesson notes are only available for subscribers.