Microsoft Access ITEC2404 Lab #3 Subject: Custom Form Design This lab requires the same database that you used for the last lab. (LabData2000.mdb) You will not need any of the material that you completed for last lab, so if you need to, you can simply download the LabData2000.mdb database again. (Don't forget though, you will need the table created in problem #5 in the last lab "Mailing List for Coupons" table for lab #4) It might be a "very" good idea to review the lecture & quiz for the previous three classes before attempting to do this lab, as many of the answers to questions that might arise are included in these lectures. Also, several hints as to just what I am going to be looking for are also included in these lectures. The purpose of this lab is to design a form for data entry into the pet table. Figure 1-1 below is what the final form should look like. Everything should line up properly. This lab is also designed to introduce you to creating custom forms and the importance of alignment features and other properties of controls on a form. Remember, carelessly designed forms will defeat the purpose of creating a user friendly system. The more time spent on creating a form and the more thought put into it's creation, the less time it will take in doing the task that the form is meant for and therefore use of the form will create a greater level of productivity. IMPORTANT: The sequence in which you do the following is critical. Pay attention to the detailed instructions. Points will be taken off if you miss a step or get out of sequence. Everything must be perfectly aligned. 2% will be taken off for anything that looks out of line, (ie: text that does not fit in the field, label or text box alignment, etc.) Make sure that both alignment features are checked and that where necessary, labels (especially the labels on the upper left side of the form) are right aligned and the data inside the labels are aligned like the example. ie either Right or Left Aligned, not General. (the right alignment will be checked on these labels ... Left Position plus Width = Right Position). Also, make sure that your text boxes are big enough to fit all data. Points will be taken off for data that is truncated. When you are finished, you can use the check list below to make sure that everything is done and correct. To begin you will need to build a query using both the Customer Table and Pet Table. Start your query with the customer table and add the fields to your grid from the "Customer Number" through the "Phone Number" Add your pet table to the query and use the fields from the "Pet ID" through the "Comments" Save this query as "Customer and Pet Data" and close the query. Now it's time to start the form. Start your form using the "Customer and Pet Data" query from above. (Hint: begin with a blank form, not wizard) From your blank form's menu bar "VIEW" - "FIELD LIST". Drag all the available fields that are from the Pet Table (Pet ID through Comments) in a group to the detail section of your form. Place them in the upper left portion of the form somewhere near the 1 1/2" mark. When you release the mouse button, the "data" part of each field/control should be about at the 1 1/2" mark. You might find it easier from this point on to change the settings on the Form's property sheet for the X and Y Grids to 16. Now, rearrange the fields/controls to look like the example. Remember you can move either the label or the text box by using the pointing finger - not the hand - (and pointing to the large handle in the upper left corner of the field/control). Don't worry about the fields/controls from the customer table yet. Line up all the labels and text boxes like the example. Set the text in all the labels to "Bold". If you need to re-size anything, now is a good time. Go to the "Form View" and notice that your graphic is sick. Go back to the "Design View" and click on the picture control and then view properties. Find the Size Mode Property and change it from "Clip" to "Stretch" so that your picture will not be distorted. Now try "Form View" again. Your picture should be OK now. When you get this far and looking pretty good, save your form as "Pets Data Entry". Now, from your Field List, drag in the available fields that are from the Customer Table from "Type of Customer" through "Phone Number" to your form detail section placing them in the upper right portion somewhere around the 5" mark. When you release the mouse button the text boxes should be about at the 5" mark. You will move these later so not to worry if they don't line up exactly. Drag the "Type of Customer" label and text boxes down and out of the way for the time being. Select all the remaining labels (caution: labels only) from the customer table fields and delete them. Move the remaining text boxes until they look like the example. Note that you will have to re-size some of them and that the City, State and Zip are on the same line and that they are almost adjacent to each other. If necessary, move these boxes down to make room for the label that contains the text "Customer Information". The "Type of Customer" data field in the table contains a number - 1, 2, or 3 which is a code fro "Individual", "Pet Store" or "Zoo". If we leave it as it is, the numbers will show in the Form's text box. We would like to have words instead. To accomplish this we will use a function that will help Access decide what the numbers mean. Click on the Type of Customer text box (not the label) and show the properties. Change the "Name:" property of the control to "Calculated Type of Customer". In the "Control Source" property type in the following expression: (you can use the Shift-F2 to better see what you are doing) =IIF([Type of Customer]=1, "Individual",IIF([Type of Customer]=2, "Pet Store", "Zoo")) The "IIF" is not a typo. Be sure to put the equal sign at the beginning and two (2) closing parenthesis at the end. Just type it in. Don't press the enter key until you are finished - just type and let Access do the line wrap. If you are in the Zoom Box (Shift-F2) press the OK button when finished. Note: if we had left the name of this control alone, Access would not know which "Type of Customer" we were referring to - the field from the underlying query or the control on the form. Changing the name makes Access look the field in the query for its' data. What this does is to test the data and if it is a "1" then it displays the word "Individual", if it is not a "1" then it tests to see if it is a "2" and if so it displays the words "Pet Store", otherwise, since it is neither a 1 or a 2 it must be a 3 (the only remaining option) and it will display the word "Zoo". Cool! This is called an "Immediate IF" function. For those of you that have worked with expressions in the past, that's where the "IIF" comes in instead of "IF". The "IF" function is still valid in Visual Basic and Visual Basic for Applications. Before you continue, make sure that the labels in the upper left corner of the form, [Pet ID] through [Last Visit Date] all have the same right position and that the text inside each label is right aligned (2 points will be deducted for each control and each text item inside the control not properly aligned). This means that they are all correctly right aligned as shown in the example below. Do the same for the labels [Current Vaccinations], [Deceased], and [Neutered/Spayed]. Also, make sure that you have correctly "bound" check boxes (not text boxes) on the right of the [Current Vaccinations], [Deceased], and [Neutered/Spayed] labels (if you have text boxes instead of check boxes, how to change them can be found in the lectures). Also, check the alignment of all labels that are above a field. They should be all exactly left aligned with the text boxes below them. If the [Date of Birth] text box and [Last Visit Date] Check box are showing a two digit year when you view the form, save and close the form, go to your Windows Control Panel / Regional Settings / Date Tab and change the settings to match Figure 1-2 below. Now for the Header Section of the Form. If you do not already have a header section, and if you followed the instructions, you should not have one yet, go to "VIEW" on the menu bar and select Form Header / Footer (NOT Page Header). This will create a "Header Section". Create a label in the header section (using the "LABEL" tool from the tool box) with the words: Mountain Animal Hospital - Pets Data Entry A good font to use is MS Sans Serif, bold and 18 point. You may use whatever you like later as long as it is legible, but for now keep it this size because we will be adding some stuff in the header in a little while. - like a command button. Close up the footer section by dragging the bottom of the footer up until it disappears. There are still a couple of items that need attention. First you will note that in the Form View you go from field to field in a somewhat haphazard manner. We need to go the fields in the order presented. Secondly, we can change data in the Customer Table - the one side of the "One to Many" relationship. Let's take care of the second item first. Select all the controls under Customer Information, Type of Customer and the Picture on your Form. Display the properties and look for the Tab Stop Property. Change this from Yes to No. Look for the Locked Property and change this from No to Yes. That will stop any changes from being made to these fields. Try it out! Now, to fix the first problem. In the Design View select "VIEW" from the menu bar and then select "Tab Order". In the window that appears next, click on the "Auto Order" button. Test the tab order by viewing the form and pressing the tab key to move through the fields. Why not add a button in the header section to close this form with! (This is optional but 5% extra credit will be added to your lab grade - not to exceed 100% - for a properly working button) The only problem now is that if you try to print, it will try to print 129 records! We only need one. To accomplish this, first set a "Page Break" at the end of your form while in the design view, then when you attempt to print from the form view, be aware of the option to print "Page" from (Page #) to (Page #). Use from 1 to 1. Note: The online section does not have to print the form for hand in, but they must include the page break. (Hint: you might want to print preview first and check the margins) If you have done everything right, your form should look about like the example. Check the alignment and size of all fields and labels. It is important that "EVERYTHING" is lined up and that there is room for everything in each field. One reason for creating a form to begin with is to make it easier for the user to view, enter and edit data. Important: Points will be taken off for fields and labels that are not neatly aligned and for data that is not all visible in fields. What to hand in For the Friday Night In Class section (not the Online section ): Rename LabData2000.mdb to Lab3nnnn.mdb where nnnn is the last four digits of your student ID#. Copy Lab3nnnn.mdb to a blank 3.5 inch floppy and hand in. (don't forget to write your name on the disk's label) If your database is to big to copy to a floppy, you can compact it first. See pages AC 1.24 and AC 1.25 in your book for instructions on compacting. You can also find a program called WinZip on our FTP site. After compacting the database, if it is still to big to email, consider using the WinZip program to Zip it up before you mail it. This will significantly reduce the size. For the "On Line" section: Rename the LabData2000.mdb database to Lab3nnnn.mdb where nnnn is the last four digits of your student id # and email to [email protected] Credit will not be given unless your database is named this way and it is emailed. If your database is to big to email, you can compact it first. See pages AC 1.24 and AC 1.25 in your book for instructions on compacting. You can also find a program called WinZip on our FTP site. After compacting the database, if it is still to big to email, consider using the WinZip program to Zip it up before you mail it. This will significantly reduce the size. Form that you must duplicate: Figure 1-1 Windows Control Panel / Regional Date Settings Figure 1-2 The chart below is provided as a check list so that you may check the properties of each control on the form. This is optional (but an extremely good idea) and should not be submitted. I will be using the same check list to check your work and determine grades. Remember, 2 points will be taken off your grade for each error or omission on the form. Properties for the controls on the Top Left Section of Form Label Left Position Label Width Label Label Text Right Position Alignment Text Box Left Position Text Box Width Pet ID __________ + __________ = __________ __________ __________ __________ Pet Name __________ + __________ = __________ __________ __________ __________ Type of Animal __________ + __________ = __________ __________ __________ __________ Breed __________ + __________ = __________ __________ __________ __________ Colors __________ + __________ = __________ __________ __________ __________ Length __________ + __________ = __________ __________ __________ __________ Weight __________ + __________ = __________ __________ __________ __________ Last Visit Date __________ + __________ = __________ __________ __________ __________ Properties for the controls on the Center Left Section of Form Current Vaccinations + = Label ___________ ___________ _________ Deceased Label ___________ Neutered / Spayed ___________ + = ___________ + = ___________ _________ _________ Is this a check box? (Y/N) Is this a check box? (Y/N) Is this a check box? (Y/N) ___ Control Source? _________ ___ Control Source? _________ ___ Control Source? _________ Properties for Other Controls Customer Information Label Left Position _______ Customer Name Text Box Left Position _______ The above 2 items should be the same Comments Label Left Position _______ Comments Text Box Left Position _______ The above 2 items should be the same Tab Stop (Y/N) Locked (Y/N) Customer Name ____________ ____________ Customer Address ____________ ____________ Customer City ____________ ____________ Customer State ____________ ____________ Customer Zip ____________ ____________ Customer Phone ____________ ____________ Type of Customer ____________ ____________ Picture ____________ ____________ Other things to check: Year is 4 Digit Year: (Y/N) ______ Type of Customer Expression: OK/Incorrect ______ Page Break included on form: (Y/N) ______ Graphic Size Mode set to Stretch (Y/N) ______ Form Header Section (not Page Header) used (Y/N) ______ All Data is visible (none truncated) ______ Type of Customer Text Box is right aligned with Picture is right aligned with Customer Customer Information Text Boxes? (Y/N) ______ Information Text Boxes? (Y/N) Tab order checked and works good for data entry? (Y/N) ______ Footer Section Closed up? (Y/N) ______ ______
© Copyright 2026 Paperzz