Sunday, 14 February 2010

This database contains various examples of Data Definition Language (DDL) and Data Manipulation Language (DML) of both DAO and SQL.


The examples here were taken largely (though not completely) from "Access Database Design && Programming" by Steven Roman and published by O'Reilly.
There are 5 modules:
Class 10: Shows general examples of Data Access Objects (DAO)
Class 11: Illustrates DAO DDL techniques
Class 12: Illustrates DAO DML techniques
Class 13: Shows how to use embedded SQL DDL
Class 14: Shows how to use embedded SQL DML

Download

Access 97 (101 KB): Dao97.zip

Access 2000 DAO (144 KB): DAO2k.zip

CascadingComboBoxes.mdb (beginner)

This form illustrates how to restrict the value of one combo box based on the value of another. In this case, you choose the city, and you get a listing of just the zip codes available for that city.


It also shows how to get the asterisk (*) to show up in the RecordSource for the city, so you can choose all cities. When you choose the asterisk to list all zipcodes and then choose a zip, the corresponding City appears in the city control.

Download

Access 97 (42 KB): CascadingComboBoxes97.zip

Access 2000 (95 KB): CascadingComboBoxes2k.zip

BackUpWithCompact.mdb (intermediate)

This sample illustrates how to back up a database using the Compact Method. It creates a backup file called "BackUpWithCompact2kXX_XX_XXXX.mdb" with the X's representing the data. It puts this file in the same directory as the database. It also looks for the spreadsheet in the same directory.


Download

Access 2000 DAO (133 KB): BackUpWithCompact2k.zip

AppendValuesToExcel.mdb (intermediate)

This sample demonstrates how to append data from a database to an Excel Spreadsheet using Office Automation to find the next empty row in the spreadsheet.

The overall process:

1) Define Access and Excel object variables
2) Open Excel sheet as an Excel Object
3) Find the last row of data

4) Write data from Access query to Spreadsheet

5) Save and close spreadsheet

Look in the "basExport" module for the relevant code.

Note: This requires a spreadsheet called "ExportSpreadsheet.xls" (included with the sample) exist in the same directory as the application. Also requires references set to DAO 3.6 and Excel
Download Access 2000-2003 Version: AppendValuesToExcel.zip

Receipt Management: Stop Losing Paper Receipts Forever

Paper receipts fade, tear, and get lost. Here's how the Petty Cash app solves the receipt problem permanently. The Paper Problem Therma...