Skip to main content

  | मौसम…

411 समाचार
Public archive edition · Attributed source reporting with original dates · AI drafts are excluded

411 REFERENCE · Wikibooks

Microsoft Office/Create a basic two table database with reports

Reference material by Wikibooks contributors. This retains its source identity and is not 411 news reporting.

Vocabulary Database - a collection of organized data that allows you to look up, edit or report on it. Table - Stores information about one specific kind of item Record - The rows in a table that contain information about a given person, product, or event. Field - The columns in a table that contain a specific piece of information like the city, state, or phone number. Query - The ability to access the data by asking questions. Getting out all the companies that are in a certain city, or all the clients with the last name of Smith. Forms - Attractive layouts used for entering or looking up records in a table. Reports - Attractive layouts used for printing out the data with sophisticated presentation. Web Page - A SharePoint for information that is stored in Access so it can be seen on the web. Primary Key - a unique identifier for a record. There can be only one. Every record must have a different value in a field that is set up to be a primary key. If it is a table of products and the PRODUCT ID is the primary key, no two records can have the same ID. Data type - Specifying the type of data a certain field will hold. Access needs to know if you are going to work with a number, text, a time/date or a hyperlink. Field Size - Specifying how large the field will be. Access needs to know how large a text box needs to be created to hold text type data. Design view - A view that allows you to manipulate how data will be created, stored, and displayed on the screen and in reports. Datasheet view - A view of a table that is much like a spreadsheet. It allows you to enter in your information quickly. Report View - Once you create a report, you need to turn it to report view to preview it on the screen. Form View - Once you create a form, you need to turn it to form view to enter data, or use if for lookup. Form Layout - Once you create a form, you need to turn it to layout view if you wish to move items around on your form. Report Wizard - A tool that allows you to create a report by simply choosing what table and fields in the table you want to display. The report is built for you very quickly. Lesson What is a database? A database is a collection of organized tables. Each table is a collection of related records. Each record gives information about one item and is made up of many fields. Each field is one specific piece of information. File:AC1-Database_layout.jpg In this figure you can see the Clients Table is open in the Access work area. It contains 10 records, one for each client. There are nine fields: Client number, Client name, Street Address, City, State, Zip Code, Amount Paid, Type of Advertisement, and Employee. Guidelines Before you start to create a database, there needs to be a lot of planning. The first question should be: What is the purpose of the database? I usually want to know, what do I want to be able to pull back out of the database. So I guess I work backwards from the reports to figure out what will need to be put in. What is the purpose of the database Who all will use the database What will each type of user need to be able to do What reports does each user need What forms does each user need What transactions will each user need to document Determine the tables that you will need Determine the primary key fields Determine all other fields that you will need in each table Determine data types for each field Determine field size for each field Determine the relationship between the tables Determine what fields will need to link the tables together Remove any redundancy in the tables Requirements The yearbook staff need to keep track of their yearbook ad sales to the businesses in the community. In order to do this they will need to track the businesses of the community and what businesses have purchased ads, what types of ads they have purchased and if they have paid. They will also need to keep track of each student, in this case employee, to determine who has sold the ads. The staff will need to keep track of two basic groups of data, the businesses and the yearbook staff members. For this example we will call the businesses - Clients, and the staff members - Employees. For the clients we will need to know: Client Number Client Name Street Address City State Zip Code Amount Paid Type of Advertisement Employee Number For the Employees we will need to know: Employee Number Last Name First Name Street Address City State Zip Code Number of Ads Sold Dollar Value Sold Name the tables and fields They must not be longer then 64 characters You can use letters, integers, spaces, and some punctuation marks They cannot contain: periods (.), exclamation points(!), asterisks(*), question marks(?), accent marks(`) or square brackets([]) The same name cannot be used twice Pick a logical naming convention so you can find your information quickly Use upper cases to start words - Client Name Use no space between words - ClientName Use an underscore between words - Client_Name We will call the two tables: Clients and Employees Primary Keys Each table needs to have a primary key. This is the one value in each table that can not be repeated, it is considered the look-up value. This field is used to easily access all the data for one record and usually has a short field length. For this example we will use the: Employee Number Client Number Relationships between tables When you design a database you need to be able to tie the data together. In most databases you have one table that is used once and tied to many records in another table. In this example the Client is used once, and each client is tied to an employee. So, each record in the employee table is used many times. This is called a One to Many relationship. Employee A works with Client 1 Client 2 Client 3 Client 4 Data types When you are creating the fields you also need to think about what type of data you are collecting in each field. Here is a run down of each data type: + Structure of the Client TableData TypeDescriptionText255 Characters of any type of character including numbersMemoUsed when you want more than 255 characters of space and can contain any type of characterNumberOnly numbers that are used for some type of arithmetic manipulation. If you do not plan on adding, subtracting, multiplying or dividing the number it is safer to make it type text. CurrencyUsed for money and will auto-format to contain the dollar sign, commas and a two digit decimal. Date/TimeUsed when you are going to store a date or a timeAutoNumberThis field will start at 1 for the first record and each additional record will be one higher. This is great for use with invoice numbers. Yes/NoThis field is a check box that stores either yes/no, true/false, or on/off. OLE ObjectAn object linked or embedded in the tableHyperlinkText that can be used as a hyperlink addressAttachmentThis field will contain an attached file. This is handy if you are doing an on-line application and want have the user attach a resume. Redundancy The point to using a database instead of a spreadsheet is the ability to link tables together. This is useful for reducing redundancy. Redundancy is the repetition of the same data over and over again. For example if you are tying clients to employees, you would not want to have to tie the same employee name, address, city, state, and zip to every record. Instead you can link them both together with an employee number and store the data in separate files. By storing the data in separate file it reduces the risk that data will not be updated properly. Think about if an employee moves and the employee data is in the same table as the clients. You would have to go through all the records that had that employee and change the same data for each record that employee works with. Client Table File:AC1-Create Ribbon.jpg From the Access Window click on the: Create Tab Go to the TABLE Group on the far left of the ribbon Click on the TABLE button File:AC1-Table_Design_View.jpg Click on View and Design View File:AC1-Save_Table.jpg‎ Click on OK Then fill in the fields on the design view of the form to follow the structure of the table below. You will need to enter the field name, data type, and field size as the arrows above show. + Structure of the Client TableField NameData TypeField SizePrimary KeyClient NumberText4YesClient NameText25NoStreet AddressText30noCityText20noStateText2noZip CodeText5noAmount PaidCurrencynoType of Advertisementtext20noEmployee Numbertext2no Once you are done putting in the field definitions then you will need to put in the data. Click on VIEW Click on Datasheet View Then you can enter the data just like a spreadsheet. HINT: If you do not like entering the data this way you can click on FORM and it will create a form for you to enter the data into a form. + Client Table DataClient NumberClient NameStreet AddressCityStateZip CodeAmount PaidType of AdvertisementEmployee NumberROLARosken LLC Accountants592 Main St Suite 1MeekerCO81641$40.00Page SponsorKACOAVCoulter Aviation921 Market StreetMeekerCO81641$50.00Business CardDWMEAIMeeker Airport921 Market StreetMeekerCO81641$40.00Page SponsorWSBRLABrooks Laurie J Appraiser889 Main StreetMeekerCO81641$250.00Full Page AdEJROMORocky Mountain Bowstrings696 Main StreetMeekerCO81641$50.00Business CardWSANTOAnn Toney PC AttorneyPO Box 1022MeekerCO81641$40.00Page SponsorEJZABRZagar-Brown Trina K Attourney685 Main Street Suite 5MeekerCO81641$150.00Half Page AdKABOKEBorchard Kent A Attourney335 6th St #1MeekerCO81641$50.00Business CardKAMECOMeeker Collision Center43904 Hwy 13MeekerCO81641$40.00Page SponsorDWNOAUNorthwest Auto485 Market StreetMeekerCO81641$50.00Business CardEJ After you are done putting in all the data for the Clients you are ready to create the table for the employees and put in that data. You will follow the same steps as above. Go to Create - Table Go to View - Design View Name the table Employees Set up the fields as list in the table below Employee Table + Structure of the Employee TableField NameData TypeField SizePrimary KeyEmployee NumberText2YesLast NameText20NoFirst NameText20NoStreet AddressText30noCityText20noStateText2noZip CodeText5noNumber of Ads Soldnumber2noDollar value of Ads SoldCurrencyno Once you have created the fields for the table then go to VIEW - Datasheet View and type in the data as listed below. + Employee Table DataEmployee #Last NameFirst NameStreet AddressCityStateZip Code# of Ads sold$ value of Ads soldKAKippersAmanda123 Malle StreetMeekerCO816413$240.00DWDowningWill312 Howe DriveMeekerCO816412$90.00EJEstonJim213 Pawnee WayMeekerCO816413$340.00WSWilsonSophie332 Wilbert WayMeekerCO816412$90.00 Create a form The easiest way to create a form is to have the table open that you want the form to populate. Click on the Create Tab Go to the Forms Group Click on FORM The from is created and you are in layout view. You can move items around from this view, but when you are ready to enter data you will need to change to Form View. Go to the HOME Tab Click View Click Form View Start entering data. If you want to look through the records then use the buttons at the bottom of the screen they are just like those on all the electric devices you all use today. If you want to enter new data then click on the button that is the blue arrow pointing right with a star. Enter in the new data for the first field Press TAB to go to the next field Press SHIFT+TAB to go to the previous field Press TAB at the end of the fields on the screen will save that record and bring you to the next empty record. Print a table To print a table have the table open: Go to the Office Button Click Print arrow Click on Print Preview Change it to landscape if needed Adjust the margins if needed NOTE: You do not have the printing control like you did with Excel, if you need a better format that is when we create a report. Create a report Close all the tables and forms. Click on the CREATE tab Go to the REPORTS group Click on REPORT WIZARD File:AC1-Report Wizard Table and Fields.jpg Set the table to Clients Click on the greater than sign to move the selected field to the right (fields on the right are put into the report) Move the following fields to the report: Client Number Client Name Amount Paid Type of Advertisement Employee Number Click on NEXT File:AC1-Report_Wizard_Grouping.jpg For this report we will not do any groupings and will leave this for a more advanced topic Click NEXT File:AC1-Report Wizard Sorting.jpg Click the Drop down and choose the Employee Number (This will sort the report by employee number giving a list of clients for each employee.) Click Next File:AC1-Report_Wizard_Layout.jpg Leave this set to tabular, you are welcome to play with this and see what each one will do. click Next File:AC1-Report_Wizard_Style.jpg Look at the different styles and choose the type that you like the best Click on NEXT File:AC1-Report_Wizard_Title.jpg Type in the name of the report This is the name that will print across the top of the report so watch your typos Click FINISH Print a report Go to the office button and click on PRINT Project Create a database to keep track of a business of your choosing. You must have: multiple tables - most of you will need four tables Client table (with at least 10 records) Client number First name Last name Street address PO Box City State Zip Code Phone number Employee number - depending on your business other fields that fit your business Employee table Employee number Last name First name Street address PO Box City State Zip Code Phone number Pay Rate (if this fits your business) Other fields that fit your business Inventory or Services table (depending on your business) Item Code Item Description Item Cost Sales or Appointment table (depending on your business) Invoice number - auto number Client Code Employee Code Time Date Service or item Quantity of item or length of time on service (if this fits business) You can have more tables to keep track of your business if you need Create a form for entering data and looking up data Create a report that matches your business such as: Invoice Billing Summary Appointment Schedule Turn in a print out of: each table each report Rubric + Create a Business DatabaseStandards1 point2 points3 points4 points5 pointsChoose a business that fits your interests Could not identify a business, teacher assigned one. Identified a business that could not be investigated or one that did not merit investigation. Identified, with adult help, a business which could be investigated. Identified, with adult help, a business which was interesting to the student and which could be investigated. Independently identified a business which was interesting to the student and which could be investigated.Creates Tables for BusinessSome tables in the database had a function and clearly served to illustrate some aspect of the business. Each table in the database had a function and clearly served to illustrate some aspect of the business. Some tables had most fields that were correctly labeled with name, data type and size.Each table in the database had a function and clearly served to illustrate some aspect of the business. Most tables had most fields that were correctly labeled with name, data type and size.Each table in the database had a function and clearly served to illustrate some aspect of the business. All tables had most fields that were correctly labeled with name, data type and size.Each table in the database had a function and clearly served to illustrate some aspect of the business. All tables had fields that were correctly labeled with name, data type and size.Creates Forms for BusinessCreates a form for a tableCreates a form with adult assistance that allows for easy data entry and retrieval from a table. Creates a form with no adult assistance that allows for easy data entry and retrieval from a table. Accurately creates a form with some assistance that allows for easy data entry and retrieval from a table. Accurately creates a form with no adult assistance that allows for easy data entry and retrieval from a table. Creates a Report for the BusinessCreates row for totalA report is created for the sales or appointments table. A report is created for the sales or appointments table that shows understanding of why the report is needed. The title is descriptive.A report is created for the sales or appointments table that clearly shows understanding of why the report is needed. The title is descriptive, and the data is sorted.A report is created for the sales or appointments table that clearly shows understanding of why the report is needed. The title is descriptive, and the data is sorted in an appropriate manner. Prints Tables and Reports for the BusinessMissing 4 or more itemsMissing 3 itemsMissing 2 itemsMissing 1 item or the Report prints on more than one pageAll tables and forms are printed correctly, stapled with the report on top, and name on the back.