Live Help is Currently Available
599CD.com 08/27: MAJOR Bug Fixed in Video Player   Collapse Menus
 
 
New Releases:  8/20: Active Server Pages,  7/22: PowerPoint         [dismiss]
 
   
 

What's New?

Courses  |   Demo  |   Tips  |   Blog  |   Search  |   Help  |   Order

 
 
 
Courses - Microsoft Access 311
Description: Advanced Access
Running Time: 86 minutes
Pre-Requisites: Access 310 very strongly recommended
Versions:
We use Access XP in this course, but the lessons are valid for all versions of Access from 95 to 2003. There are cosmetic changes in Access 2007. Order before 8/30/2008 to get a FREE upgrade to our 2007 version when released!
 

Access 311 covers adding cost to our database so we can track net profit or loss for our sales. We'll also build a custom sales report and sales form for reporting. Finally, we'll create a form that has dynamically generated SQL to control what records and sorting are in the form.

First, I'd like to be able to figure out how much profit I'm making on each order by knowing the cost of my labors and materials. We'll start out by adding UnitCost info to our OrderDetailT and Order Subform. We'll add subtotals to the form as needed.

 

Next, we'll create a SalesReport query and report to show each order, what our cost is on that order, and what our net profit is.

 

Using our Sorting & Grouping levels and the Format() function, we'll create a custom format and breakdown for all of our sales by month.

 

We'll then create a simple form to set the limits (begin date and end date) for our sales report. Using the Forms ! FormName ! Field notation and the Between keyword to limit our sales query / report based on this information.

 

Next comes something that will add a whole new dimension to your form design... creating forms with a dynamic SQL statement controlling their records. In this case, we'll make our Order List form able to show quotes, invoices, paid invoices, unpaid invoices, and both quotes and invoices all by just selecting the option from a combo box. Our VBA code will construct an SQL statement which will update the records.

 

We'll also create a combo box to change which field our records are sorted by (company, name, amount due, order total, date, etc.) and a Sort A-to-Z or Z-to-A button to control ascending/descending sorts. This might sound easy, but we have to do it all using VBA code and events - take nothing for granted!

 

 


ACCESS 311 - Course Outline

0. Introduction - 2:42

1. Unit Cost on Orders - 13:16
Being able to calculate profit by knowing item costs
Adding UnitCost info to OrderDetailT
Creating an ExtendedCost field (UnitCost * Quantity)
Adding UnitCost and ExtCost to our OrderDetailF
Adding calculated totals to footer
Adding Cost fields to our Product Table
Get the product cost when a product is selected from ComboBox

2. Sales Report - 12:07
Creating a Sales Report with Cost & Profit
Add cost information to OrderListQ
Create the SalesReport Query and Report
Format() function to force numbers to show as currency

3. Sales Report & Form - 13:49
Adding totals to our Sales Report
Remember you can't put SUMs in your Page Footer
Create a Report Footer
Sort our Sales by Date - Sorting & Grouping Level
Group Header & Footer ON
Group On: Month
Format() Function: Format(OrderDate,"yyyy mmmm")
Criteria form to set begin date and end date for sales report
The Between keyword (remember me?)
[Date] is no good. Use Date()

4. Dynamic SQL Form 1 - 10:10
Clean up Customer List Form
Added Browse Customers and Add New Customer Buttons
DoCmd.GoToRecord acNewRec
Clean up Order List
Create an OrderList2Q so we can make more calculations
Add AmountDue information to OrderList form
Discuss what the Dynamic SQL Form is going to do

5. Dynamic SQL Form 2 - 14:44
Create a combo box with a list of options:
 - Show Invoices & Quotes
 - Show Quotes Only
 - Show Invoices Only
 - Show Paid Invoices Only
 - Show Unpaid Invoices Only
These are the options we want to see in our Order List Form
Set the default value for the combo box
Create an unbound text box to hold our SQL statement
Review of SQL Statements
SELECT Fields FROM Table WHERE Criteria ORDER BY Field
Create the BuildSQLStatement sub
Creating your own Private Sub
Set the form RecordSource equal to our SQL statement
Me.RecordSource = MySQL
Using VBA Code to build the SQL statement based on selection
Using a SELECT CASE statement instead of IF THEN statements
Creating another combo box for sorting:
 - Sort by Order Date
 - Sort by Company Name
 - Sort by Last Name
 - Sort by Order Total
 - Sort by Amount Due
Add another SELECT CASE to handle the ORDER BY clause

6. Dynamic SQL Form 3 - 17:07
Checking our Sort Combo Filter
Put a call to BuildSQLStatement in the SortCombo build event
Put a call to BuildSQLStatement in the form OnOpen event
DEFINITION - right click on a function or sub name to jump
Create our own Sort A to Z (ascending / descending) button
Capturing an image on the screen with Print-Screen
Drop that capture into Windows Paint
Cut out the buttons you want to "borrow"
Paste the buttons into your form.
Change the border style (raised, sunken)
Change the button names: SortAZ, SortZA
Make SortAZ visible, SortZA not visible
If the SortZA button is visible, add "DESC" to SQL Statement
Make OnClick events for each of these buttons
Change Enabled = YES for these buttons
"You can't hide a control that has the focus"
Shift the focus with DoCmd.GoToControl
Hide your SQL text box
Add buttons to browse orders, add new order
Change SortAZ and SortZA buttons to IMAGES not OLE objects

7. Review - 2:26


 

Huge Discounts Available
When you purchase multiple classes together - up to 50% off!
 

Student Interaction: Microsoft Access 311

Richard on 1/1/2008:  Access 311 covers adding COST to our product table and order details table so we can calculate job cost and net profit; dynamically generating SQL statements to control the records on a form; advanced sorting and grouping on reports; more with the Format() function; major overhaul to the OrderListF form.
Alan Hill on 1/11/2008: Some SQL's get pretty complicated. I found creating a query and switching to SQL mode, copying and pasting can be helpful. You did not cover that alternative. I thought the image AZ and ZA buttons was a neat trick. That was new to me. Thanks
Richard Rost on 1/12/2008: I believe I covered this in Access 202. I showed you the button that switches between DESIGN mode and DATASHEET mode also can show you the SQL of a query. You're right though - I should have mentioned it again when we started covering dynamic SQL for forms.
 
 

You may want to read these articles from the 599CD Blog:

 

 

Need
Help?

   
Do you have questions about Word, Excel, Access, Web Design, or computers in general? Just ask us anything you'd like.
 

Get Free Tips & Tricks
 

Join our mailing list today and get information on our Free Tips & Tricks Newsletter including free video tutorials, eBooks, live seminars, and more.

Email:
Name:
Type in the word to the left:
 
Your email will be kept 100% safe and will never be given to 3rd parties.
 


CLICK HERE for a FREE lesson



Order your first 599CD course now.
Your Satisfaction is Guaranteed!


 

 
 NEW:  Watch all of our courses online in the 599CD Theater
 

599CD Home   |   Learn More   |   What's New?   |   Contact Us   |   Free Demo   |   FAQs   |   Order Now   |   Become an Affiliate   |   TechHelp   |   MYOLP   |   Jobs   |   Chat   |   Downloads   |   Handbooks  (Text)   |    Mailing List   |   Lost Passwords   |   Referral Program   |   Online Poll   |   Troubleshooter   |   Corporate / Educational / Government / Non-Profit Sales   |   Message Forums   |   Testimonials   |   Privacy Policy   |   Tips & Tricks

 
 

What's New  |  Home  |  Courses  |  Demo  |  Learn More  |  Contact  |  Order