Week 2 concentrated on topics that are of value to developers in the standalone and workgroup environments. A wide variety of topics were covered in Week 2, including
Here is a more detailed look at the topics covered in each lesson:
You learned in Day 8 how to create basic SQL statements that select data from existing tables. You learned that the most fundamental form of the SQL statement is the SELECT_FROM clause. This clause is used to select one or more columns from a table and display the results of in a result set, or view.
You also learned about the optional clauses that you can add to the SELECT_FROM clause:
You also learned about additional SQL keywords that you can use to control the contents of the result set:
In Day 9's lesson, you learned the features and functions of Visual Basic Microsoft Jet data-access objects and ODBCDirect access objects. These objects are used within Visual Basic code to create and maintain workspaces, databases, tables, fields, indexes, queries, and relations. You learned the properties, methods, and collections of each object. You also learned how to use Visual Basic code to inspect the values in the properties, and how to use the methods to perform basic database operations.
On Day 10, you learned how to write data entry forms using Visual Basic code. These topics were covered: record search routines, the creation of a procedure library to handle all data entry processes, and creating a working data entry form for the CompanyMaster project.
You learned how to perform single-record searches using the three search methods:
You created an OLE Server library to handle adding, editing, deleting, reading, writing, and locating records in datasets. These routines were written as a generic DLL that can be inserted into all Visual Basic programs you write in the future.
You used the new library to add a new form to the CompanyMaster database project. This new form reads a dataset and allows the user to update and browse the table. This new data entry form was built using fewer than 30 lines of Visual Basic code.
On Day 11, you learned how to use the graph control that ships with Visual Basic 5 to create visual displays of your data tables. You learned how to add the control to your project and how to load the graph control with data points, titles, legends, and labels.
Also, you built a graph ActiveX DLL object library that you can use to display virtually any dataset in a variety of graph formats. This library lets you save the graph to disk, send the graph to the printer, or copy the graph to the Windows Clipboard for placement in other Windows programs through the Paste Special operation.
While building the graph library, you learned how to declare and use enumerated constants to improve the readability of your Visual Basic code.
Finally, you used the new graph library to add three graphs to the CompanyMaster project.
On Day 12, you learned how to load and use three of the data-bound controls that are shipped with Visual Basic 5:
You learned how to link these new controls to Recordsets using the Visual Basic 5 data controls and how to use these links to update related tables.
You also learned several of the important Visual Basic 5 events associated with the data grid. These events let you create user-friendly data entry routines using just a data control and the data grid.
Finally, you drew upon your knowledge of data grids, SQL, and form layout to design and implement a data entry subform. This form showed a master table at the top, and a related list table at the bottom of the form in a data-bound grid.
On Day 13, you learned how to create, alter, and delete database table structures using DDL (Data Definition Language) SQL keywords. You also learned that using DDL statements to build tables, create indexes, and establish relationships is an excellent way to automatically document table layouts. You learned how to maintain database structures using the following DDL keywords:
The final lesson of the second week covered all the basics of creating your own error-handling routines for Visual Basic applications. You learned that an error handler has three basic parts:
You learned that an error handler has four possible exits:
You learned how to use the Err.Raise method to flag errors without resorting to modal dialog boxes.
You learned about the major types of errors that you are likely to encounter in your program:
You also learned that you can declare a global error handler or a local error handler. The advantage of the global error handler is that it allows you to create a single module that handles all expected errors. The disadvantage is that, because of the way Visual Basic keeps track of running routines, you are not able to resume processing at the point the error occurs once you arrive at the global error handler. The advantage of the local error handler is that you are always able to use Resume, Resume Next, or Resume label to continue processing at the point the error occurs. The disadvantage of the local error handler is that you need to add error-handling code to every routine in your program.
Finally, you learned how to create an error handler object library that combines
local error trapping with global error messages and responses. The error handler
object library also contains modules to keep track of the procedures currently running
at the time of the error, a process for printing procedure stack dumps to the screen
and to a file, and a process that creates an error log on file for later review.