In the following project, using data on homes for sale that Amy and Zac acquired, you are able to target properties that meet specific criteria. As you examine the data, you discover other ways to analyze the properties. You create several queries and present your results to the two investors for their comments. You also create several totals queries to evaluate the property lists.
Start Access. Open the downloaded Access file named Exp19_Access_Ch03_HOEAssessment_Property_Sales. Grader has automatically added your last name to the beginning of the filename. Click Enable Content on the Security Warning message bar.
Now that you have opened the database, you begin your analysis by creating a query using the Properties and Agents tables from the Property database. The Properties table contains all the properties the investors will evaluate; the Agents table contains a list of real estate agents who represent the properties’ sellers. In this exercise, you will add requested fields and only show properties that have not been sold. You will then build an expression to calculate the price per square foot for each property.
Use Query Design to create a new query. The Show Table dialog box opens so you can specify the table(s) and/or queries to include in the query design. Add the Agents table then the Properties table. Close the Show Table dialog box.
Add the FirstName and LastName fields from the Agents table to the query. Add the ListPrice, SqFeet, and Sold fields from the Properties table to the query. Run the query and view the 23 properties that display in the query results.
Switch back to Design view and add No in the Criteria row of the Sold field. Sort the query in Ascending order by the ListPrice field. Run the query and view the 17 unsold properties in order from least expensive to most expensive.
Save the query as Price Per Square Foot.
Switch to Design view. In the Field row of the first blank column of the query design grid, right-click and select Zoom. Add PricePerSqFt: xListPrice/xSqFeet and click OK. Access inserts square brackets around the fields for you. Be sure that you added the extra x’s to the field names. You are intentionally misspelling the field names to see how Access will respond.
Run the query. In the first Enter Parameter Value dialog box, enter 200000 and click OK. Access does not recognize xListPrice in the tables defined for this query in the first record. When Access does not recognize a field name, it will ask you to supply a value.
Another Enter Parameter Value dialog box displays, asking that you supply a value for xSqFeet. Again, this error occurs because the tables defined for this query do not contain an xSqFeet field. Type 1000 in the second parameter box and press ENTER. The query has the necessary information to run and returns the results in Datasheet view. Examine the results of the calculation for Wrong Price Per Sq Ft. All of the records show 200 because you entered the values 200000 and 1000, respectively, into the parameter boxes. The two values are treated as constants and give the same results for all records.
Return to Design view and display the Zoom window. Correct the errors in the PricePerSqFt field by changing the formula to PricePerSqFt: [ListPrice]/[SqFeet] and click OK.
Run the query and adjust column widths as necessary. The new calculated field, PricePerSqFt, is displayed. The new field divides the values in the ListPrice field by the values in the SqFeet field.
Save and close the query.
Now, Amy and Zac would like to see the field formatted with two decimal places. You will change the format to Currency and add a caption to the calculated field.
Make a copy of the Price Per Square Foot query and name it Price Per Square Foot Formatted.
Open the Price Per Square Foot Formatted query in Design view. Display the Property Sheet (in the Show/Hide group on the Design tab) for the PricePerSqFt calculated field. Change the field format to Currency then change the Caption to Price Per Sq Ft (no period). Close the Property Sheet.
Run the query to view your changes. The calculated field values are formatted as Currency, and the column heading displays Price Per Sq Ft instead of PricePerSqFt.
Save and close the query.
You will create a copy of the Price Per Square Foot Formatted query from the previous step and paste it using a new name. You will add a few more calculated fields to the new query. You will create one calculation to determine the price per bedroom for each house. You will create a second field to calculate the price per room. For this calculation, you will assume that each property has a kitchen, a living room, a dining room, and the listed bedrooms and bathrooms.
Create a copy of the Price Per Square Foot Formatted query and name it List Price Calculations.
Open the List Price Calculations query in Design view. Display the Builder window for the PricePerSqFt column (in the Query Setup group). The Expression Builder dialog box opens, displaying the current formula.
Change the PricePerSqFt field name to PricePerBR and remove the [SqFeet] field. In the Expression Elements box, select Properties table from the Exp19_Access_Ch03_HOEAssessment_Property_Sales database.
The fields from the Properties table are now listed in the middle column (Expression Categories). Add the Beds field to the expression box.
The expression now reads PricePerBR: [ListPrice]/[Properties]![Beds].
Delete the [Properties]! prefix in front of Beds.
The expression now reads PricePerBR: [ListPrice]/[Beds].
As the Beds field name is unique within our query, the table name is not necessary. Removing this makes the query easier to read. If a field named Beds appeared in more than one table in our query, removing the table name would cause problems.
Close the Expression Builder. Run the query. Notice that the column heading still reads Price Per Sq Ft. Also notice that the column’s contents are formatted as Currency. These settings were copied when the query was copied.
Switch to Design view and ensure that the PricePerBR field is selected. In the Property Sheet, change the Caption to Price Per Bedroom. Close the Property Sheet and run the query. The PricePerBR column now has an appropriate caption.
Switch to Design view. Make a copy of the PricePerBR expression and paste it in the next blank column. You will edit the copied expression so that it reflects the price per room, assuming that the kitchen, living room, dining room, and the bedrooms and bathrooms will make up the number of rooms.
In the Builder window, change the PricePerBR field name to PricePerRoom. Add an opening parenthesis before the [Beds] portion of the formula and a plus sign after [Beds]. Because you want the addition to be done first, you will enclose the addition part in parentheses.
The expression box should read PricePerRoom: [ListPrice]/([Beds]+
In the Expression Elements box, select Properties table from the Exp19_Access_Ch03_HOEAssessment_Property_Sales database and add the Baths field to the expression box. Type another plus sign after [Baths] and type 3 followed by a right parenthesis. In other words, you will type +3) in the expression box. Delete the [Properties]! portion of the expression and click OK.
The expression now reads PricePerRoom: [ListPrice]/([Beds]+[Baths]+3).
Your final formula is the list price divided by the total number of rooms. The total number of rooms is the number of bedrooms (in the Beds field), plus the number of bathrooms (found in the Baths field), plus 3 (a constant representing the kitchen, living room, and dining room).
In the Property Sheet, change the caption to Price Per Room and change the Format to Currency. Close the Property Sheet.
Run the query, adjusting the column widths as necessary, then save and close the query.
Amy and Zac feel like they are close to making an offer on a house. They would like to restrict the query to houses that cost $210,000 or less. They would also like to calculate the estimated mortgage payment for each house. You create this calculation using the Pmt function. You make the following assumptions: 75% of the sale price to be financed, a 30-year term, monthly payments, and a fixed 3.65% annual interest rate.
Make a copy of the Price Per Square Foot Formatted query and call it Mortgage Payments. Open the Mortgage Payments in Design View. Add <=210000 to the Criteria row of the ListPrice column. The query, when it is run, will show only the 7 houses that haven’t been sold that cost $210,000 or less.
In the first blank column, display the Builder window. Add the Pmt function to the expression builder window (Functions ? Built-In Functions ? Financial).The expression box displays:
Pmt(«rate», «num_periods», «present_value», «future_value», «type»)
Position the insertion point before the Pmt function. Type Payment: to the left of the Pmt function, with a space after the colon. The expression box now displays:
Payment: Pmt(«rate», «num_periods», «present_value», «future_value», «type»)
Substitute the appropriate information in each argument ensuring that there is a comma between each argument.
Argument
Value
«rate»
.0365/12
«num_periods»
30*12
«present_value»
[ListPrice]*.75
«future_value»
0
«type»
0
Note that the loan is a 30-year loan with 12 payments per year, hence the calculation for the number of payments. Also note, Amy and Zac plan on financing 75% of the cost, putting 25% down. Therefore, you will multiply the list price by .75 (75%).
Change the format of the Payment field to Currency then close the Property Sheet and run the query. Notice that the payment amounts are negative numbers (displayed in parentheses). You will edit the formula to change the negative payment values to positive.
Switch back to Design View. In the Builder window of the Payment field, add a minus sign (-) to the left of [ListPrice] then click OK. By adding the negative sign in front of the ListPrice field, you ensure that the value is displayed as a positive number. The expression now reads:
Payment: Pmt(.0365/12,30*12, -[ListPrice]*.75,0,0)
Run the query, adjusting the column widths as necessary. The query now displays a column containing the calculated monthly mortgage payment, formatted as currency.
Save and close the query.
Amy and Zac decide it would be helpful to analyze the property lists they purchased. Some of the lists do not have homes that match their target criteria. The investors will either purchase new lists or alter their criteria. You create several totals queries to evaluate the property lists. You begin your property list analysis by creating a total row in Datasheet view of the Mortgage Payments query. This will give you a variety of aggregate information for important columns.
Open the Mortgage Payments query in Design view. Drag the ListingID field from the Properties table to the fifth column. The ListingID field is now in the fifth column, between the SqFeet and Sold fields. The other columns shift to the right.
In Datasheet view, click Totals in the Records group on the Home tab. In the Total row, display the Average List Price for all the properties that have not sold. Adjust column widths as necessary to ensure that all values are displayed.
The average list price of these properties is $165,294.36.
In the Total row, display the Count of ListingIDs.
The count of properties in this datasheet is 7.
In the Total row, display the Average Price Per Sq Ft.
The average price per square foot is $115.32.
Save and close the query.
Now, you create a totals query to help Amy and Zac evaluate the properties in groups.
Create a new query, via Query Design, and add the Properties table.
Add the SalePrice and Sold fields to the query (in that order) then Display the Total row (Show/Hide group of the Design tab). A new row labeled Total displays in the query design grid, between the Table and Sort rows. Each field has Group By listed in the new row by default.
In the SalePrice column Total row, change Group By to Avg. In the Sold column Total row, change Group By to Where then type Yes in the Criteria row. This criterion will limit the results to sold houses only.
Change the SalePrice format to Currency. Close the Property Sheet. Run the query and adjust the column width, if necessary. The results show an overall average of $333,838.77 for the sold properties in the database.
Save the query as Overall Results then close the query.
Create a new query, via Query Design, and add the Properties and Lists tables. Add the NameOfList field from the Lists table and the SalePrice, ListingID, and Sold fields from the Properties table to the query.
Display the Total row then change the Total row to Avg for SalePrice and to Count for ListingID. Next, change the Total row for Sold to Where then type Yes in the Criteria row. This criterion will limit the results to sold houses only.
Change the SalePrice format to Currency then the caption for the ListingID field to Number Sold. Close the Property Sheet and run the query. Adjust column widths as necessary. Notice that Minor Houses has the lowest average sale price. As Amy and Zac are hoping to focus on inexpensive properties, they can focus on properties offered by this source. Notice also that the query results show the number of properties sold in each source, in addition to the average sale price. This will help determine which sources have been more effective.
Save the query as Results By Listing Company.
The previous query shows the average value of the properties by listing company. However, Amy and Zac learned at the seminar they attended that the longer a property has been on the market, the better your chances of negotiating a better price. You will revise the query to show, on average, how long each listing company takes to sell a house.
Copy the query, save it as Results By Listing Company Revised and click OK.
Display the Total row then change the Total row for the Number Sold column to Sum. The total number of houses sold (6) now displays at the bottom of the Number Sold column.
Switch to Design view. In the first blank column, type DaysOnMarket: [DateSold]-[DateListed] to create a new calculated field. Change the Total row from Group By to Avg then change the Format to Fixed and close the Property Sheet. The DaysOnMarket field will show the average number of days on the market for each sold listing.
Run the query and adjust the column widths as necessary. Minor Houses listings have an average of 28.00 days on the market. Since this is lower than their competitors, it lets you know they are fast with sales.
Save and close the query.
Close all database objects. Close the database and then exit Access. Submit the database as directed.