Google
 
Web RogersAccessLibrary.com

 

Rogerís Access 97 Archive

The follow is a compendium of Access 97 routines, each separated into its own database. Each database illustrates one or more possible solutions to a single problem. They are not intended to be fully functioning utilities, but rather an illustration of how the problem might be solved and are therefore intended for educational use. These routines are entirely free. You may use them anywhere and in any way you choose, with or without citation. Therefore, you agree to use them at your own risk.

For Access 2000 - 2010 samples click here.


*** Note: As of November 1, 2003, I will no longer be adding, updating, or supporting Access 97 samples. ***

 
A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Home

 

 


A

 

Animation.mdb ( intermediate )
This sample shows how to implement a variety of simple animations in an Access Form.

AreaCodes.mdb ( expert )
This application is a utility to programmatically modify Area Codes. It illustrates a number of techniques. It reads files from a directory. It parses CSV files. It reads tables in the database and fields within the tables. It steps through a list (

AuditTrail.mdb ( intermediate )
This sample illustrates one way to produce a simple audit trail table containing: machine name, login name, user name (access security), record number, field name, original value, new value, and a date/time stamp.

AuditTrail2.mdb ( expert )
This sample is a more advanced version of AuditTrail.mdb

AutonumberProblem.mdb ( beginner )
This sample illustrates a number of ways to simulate your own Autonumber primary key.


B

 

BoilerPlate.mdb ( intermediate )
This sample is a useful template for an application.

BoilerPlate2.mdb ( intermediate )
This sample is a useful template for an application. It is mostly the same as Boilerplate.mdb but with a different MainDataEntry Form.

Books.mdb ( intermediate )
"Books.mdb" and it's companion database "Books_be.mdb", make up a simple personal book inventory database. It uses the "BoilerPlate.mdb" sample to create a complete application.


C

 

CascadingComboBoxes.mdb ( beginner )
This sample illustrates how to restrict the value of one combo box based on the value of another.

CascadingComboInSubform.mdb ( intermediate )
Illustrates how to use Cascading Comboboxes in a continuous subform.

ChangingColorFields.mdb ( beginner )
This sample illustrates how to change the color of a control on a form based on information in the form. In this case, if Check 14 checkbox is checked then the values of Desc will be red, otherwise it will be blue. You can also check for values in t

CharacterScramble.mdb ( intermediate )
This application illustrates to scramble character data WITHIN A FIELD. To Randomize FIELDS WITHING A TABLE, see my sample Datascramble.mdb.

ChooseReportFields.mdb ( intermediate )
This sample very roughly illustrates how to create a query programmatically which chooses the FIELDS to be reported on a report based on the selected values of a multi-select list box.

ChooseReportFieldsRows.mdb ( expert )
This sample very roughly illustrates how to create a query programmatically which chooses the FIELDS to be reported on a report based on the selected values of a multi-select list box and then allows the user to specify the ROWS to be reported.

ChooseReportFromList.mdb ( beginner )
These forms illustrate how to create a clean form for launching reports.

ChooseReportFromList2.mdb ( intermediate )

These forms illustrate some advanced features in a "Report Switchboard". For less complex examples, see "ChooseReportFromList.mdb"
"Choose Report or Parameter Form" allows the user to select either a report directly or a form in which

CleanFileHTML.mdb ( intermediate )
This sample removes the HTML tags from an html document and writes it into a separate text file. See Module 1 for the code.

ComboChoosesRecord.mdb ( beginner )
This illustrates how to have a combo box in which you can choose a value and have that record appear in the form.

CompactDatabase.mdb ( expert )
This sample illustrates how to compact the current database programmatically. It assumes that the tables reside locally. (To compact a Back-end database, see my sample "CompactBackEndDB.mdb".)

CompareTwoTables.mdb ( intermediate )
This sample shows how you can programmatically compare two tables and write out the differences to a third table.

ContinuousFormWithNewRecordOnTop.mdb ( intermediate )
This sample illustrates two ways to have a continous form with the new record on top. The first method uses unbound controls in the header of the form and the second uses a bound subform set to Data Entry.

ConvertStringStuff.mdb ( intermediate )
Demonstrates how to convert a variety of strings into their numeric equivalents and back.

CopyObjectsFromBE.mdb ( intermediate )
This sample demonstrates how to copy objects from the Back-End database into the Front-End. In this specific case the objects are queries.

CreateDescriptionProperty.mdb ( intermediate )
This sample demonstrates how to create and modify the "Description" property of the following Database objects: Tables, Table Fields, Queries, Query Fields, Forms, Reports, Macros, and Modules.

CreateMultiSelectQuery.mdb ( intermediate )
This database illustrates how to create a query programmatically based on the selected values of a multi-select list box.

CreateQueries2.mdb ( intermediate )
This database illustrates several examples of programmatically creating queries.

CreateQueries3.mdb ( intermediate )
This form shows how to create a query programmatically from a form with option boxes.

CreateQueries4.mdb ( expert )
This form illustrates how to create a relatively flexible inter-active query facility for an end-user. It allows you to choose the table, then shows the fields available for that table and then values available for the fields.

CreateQueries5.mdb ( expert )
This set of samples illustrate how to create a flexible query generator for your users. It is similar to CreateQueries4.mdb, but no longer limits the query to 3 criteria.

CreateQueryFields.mdb ( intermediate )
This sample illustrates how to programmatically create a query based on a table or another query and select only those fields that you want to see. It also has a form, which shows how to restrict the rows based on a criteria.

CrossTabReport.mdb ( intermediate )
The problem with crosstab queries has always been that if you try to make a report based on one, you inevitably have problems with field names when the crosstab changes. This sample demonstrates how you can get around this problem.

CSVtoFixed.mdb ( intermediate )
This sample reads a CSV file and exports it as a fixed width file. Module 1 (CSVtoFixed) does the entire process in code. For very large records, Module 2 (CSVtoFixed2) uses a table to allow you to create your own Export Spec.

CurrentTab.mdb ( beginner )
This form illustrates how to programmatically scroll between tabs of a tab control on a form. See the code behind the buttons for details.


D

 

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

DataEntryMask.mdb ( beginner )
This sample illustrates a way to restrict what kind of characters are input into a textbox without using an input mask. This method checks the characters as they are typed and only allows legal characters.

DataScramble.mdb ( intermediate )
This application illustrates how to scramble data in a table for confidentiality reasons. To scramble Text data WITHIN A FIELD, see my sample CharacterScramble.mdb.

DateStuff.mdb ( intermediate )
This example illustrates how to do a variety of date calculations like: First day of Month, Last Day of Month, First Day of Next Month, First Day of Current Week, Last Day of Current Week, First Day of Current Work Week, Last Day of Current Work Week.

DeleteTablesAtStart.mdb ( beginner )
This sample illustrates how to delete ImportError tables at start up. For illustration purposes, the RunMacro button executes the code, but if you rename the macro to AutoExec, it will run each time the database opens.

Denormalize.mdb ( intermediate )
This example takes data in a normalized table and writes it to another table in denormalized form.

DirectoryList.mdb ( intermediate )
This sample shows how to "role your own" directory/file list.


E

 

EmailingSpecificReports.mdb ( expert )
This illustrates how to email the same report with different data to a variety of users.

ExportFormattedFixed.MDB ( intermediate )
This shows how to export to a fixed width text file programmatically.

ExpressionEvaluation.mdb ( intermediate )
This form illustrates how to make a pop-up dialog to calculate values to put into a field on a form.


F

 

FlatFileDemo.mdb ( beginner )
This example illustrates some of the difficulties inherent in bad (non-normalized) database design and how they can be corrected. It is not a formal tutorial on Normalization, rather it is a series of examples which allow you to demonstrate the kind of tr

FormSubform.mdb ( beginner )
This form illustrates how to use Domain functions to do a variety of tasks in a Form/Subform situation.


G

 

GetPathFileName.mdb ( intermediate )
This form shows how to extract just the Path or just the File name from the db.Name property.

Greenbar.mdb ( beginner )
This sample illustrates how to make your report a "greenbar" report, that is one that has alternating lines of color. Check behind the individual reports for the relevant code.


H

 

HasContinued.mdb ( intermediate )
This example illustrates two methods of how to work around the 'HasContinued' bug, so that you can get a 'Continued' status for group headers within a report.


I

 

ImplementingM2MRelationship.mdb ( beginner )
This example illustrates two different methods of implementing in a form a Many-to-Many relationship that has been resolved by a linking table.

ImportHTML.mdb ( intermediate )
This sample illustrates how to use the LineInput statement to import text from a text file in an extremely unconventional format. The file is an HTML file, and the code searchs for the HTML tags to find specific information and puts that in a field.

ImportLineInput.mdb ( intermediate )
This sample illustrates how to use the LineInput statement to import text from a text file with a mixed format. Each line of the file is a separate record, but is delimited in a variety of ways.

ImportToTempDatabase.mdb ( intermediate )
This illustrates how to programmatically create a database to hold a temp table for updating.


K

 

KeepingDatabasesInSync.mdb ( intermediate )
Illustrates a method for keeping Access Front-Ends in sync with a Master Network Copy. Uses a DOS batch file.

KeepingDatabasesInSync2.mdb ( intermediate )
Illustrates a method for keeping Access Front-Ends in sync with a Master Network Copy. This is an "All Access" solution, so does not require a batch file.


L

 

LinkTables.mdb ( intermediate )
This example illustrates how to programmatically link tables from a users designated database.

LinkTextFiles.mdb ( intermediate )
This sample illustrates how to programmatically link TEXT files to your database.

ListBoxExcludeOnClick.mdb ( intermediate )
This sample illustrates two ways to remove a value from a bound list box after it has been selected (double-clicked).

ListBoxSetTableValue.mdb ( intermediate )
This sample illustrates how to use a list box to update a "Selected" field in a table and also read which items are selected in the table and set those list box items to True.

ListBoxSorting.mdb ( intermediate )
This sample database show various ways of sorting a listbox by clicking on the header of each column.

ListboxSubform.mdb ( intermediate )
This sample illustrates use a list box to simulate a simple subform. The user can either double-click the listbox or click the edit button. Then a popup form appears which allows him to select multiple values. These values are written to a separate tab

ListBoxTypeIn.mdb ( intermediate )
These forms illustrate how to use a binary search routine to jump to a value in a list box as you are typing in a text box. It is similar to how the Index tab works in Windows Help files.

LogUsersOff.mdb ( intermediate )
This sample illustrates how to automatically log all of your users out of an application for maintenance purposes.

LogUsersOffNonUse.mdb ( intermediate )
This sample illustrates how to automatically log your user out of an application after a period of inaction.


M

 

MaxQueryProblem.mdb ( beginner )
The Problem: You want to create a query which will return a MAX Date and the corresponding Amount, grouping them on the Customer Name.

Median.mdb ( intermediate )
Surprisingly, Access has no Median function, so you have to write one of your own. This sample database shows how to do that.

MoveList1.mdb ( intermediate )
This example illustrates how to move values between list boxes much like many of the Access wizards.

Movelist2.mdb ( intermediate )
Illustrates how to move values between multi-select list boxes much like many of the Access wizards.

MultipleLabels.mdb ( intermediate )
This form illustrates how to print multiples of specific labels.

MultipleLabelsOffset.mdb ( intermediate )
This sample is a more complete version of MultipleLabels.mdb. It is meant to be a simple minded stand-alone address label program.

MultiSelect.mdb ( intermediate )
Form illustrates two methods how to write values selected in a multi-select list box into a table.

MultiSelectProblem.mdb ( intermediate )
There are two methods of moving data from a multi-list select box. This form illustrates why the ItemsSelected collection is not reliable.


N

 

NoDataInReports.mdb ( beginner )
This sample illustrates how to cancel a report that has no data in it, using the OnNoData event of the report.

NormalizeDenormalize.mdb ( intermediate )
It illustrates how to take a table which has fields like Value1, Value2, Value3,... and writes them into a table which has one field (Value) with each of the values in a new record rather than having them all in one record.

NotInList.mdb ( intermediate )
This sample illustrates a variety of ways to use the NotInList event of a combo box.

NotInListAlternatives.mdb ( intermediate )
This sample illustrates several methods other than Not In List to add new records to a combo box that is Limited to the List.

NumberedQuery.mdb ( beginner )
This sample illustrates two different ways to create a query with a sequenced number column.


O

 

OpenArgs.mdb ( intermediate )
This application illustrates how to use OpenArgs to solve a variety of problems.

OrderListBox.mdb ( intermediate )
This sample shows how to make a listbox reorder by clicking on the column header. It also shows how to use the same button to sort ASC or DESC

OtherProblem.mdb ( expert )
This example shows one method of handling the situation where the user wants a combo box to pick from, but also wants to have an "Other" category where they can add free-text qualifying the "Other".

OutputText.mdb ( intermediate )
This illustrates a simple way to precisely format data for text output.


P

 

ParaQueryDelete.mdb ( beginner )
Illustrates a couple of different ways to use Delete parameter queries from forms.

ParaQuerySelect.mdb ( beginner )
This form illustrates how to send parameters to a parameter query via a form.

ParseStuff.mdb ( beginner )
The included modules demonstrate a variety of parsing problems, where information in one field needs to be put into several fields.

Pictures.mdb ( beginner )
It is usually preferable NOT to store OLE objects like pictures in the table itself. It causes massive database bloat. The usual solution is to store the pictures as files on the hard drive and store the file name in the table. This sample demonstrates

PrintingSpecificReports.mdb ( expert )
This illustrates how to print the same report multiple times with different data.

PrintMultipleLabel.mdb ( intermediate )
This form illustrates how to print multiple labels which matches the value of the record in the form.

PrintOneLabel.mdb ( intermediate )
This form illustrates how to print one label which matches 'the value of the record in the form.


R

 

ReadTableFields.mdb ( expert )
This sample demonstrates a couple of uses for Reading the table structure programmatically.

ReallyBadDatabase.mdb ( beginner )
This ZIP file contains two databases: "ReallyBadDatabase.mdb" and "ReallyBadDatabaseReborn.mdb". The first, of course, represents several common errors made when developing your first database. The second shows one way to properly design the database.

RecordNavigation.mdb ( intermediate )
This form illustrates how to exactly duplicate the actions of the default record navigation buttons including the RecordNumber Of TotalRecords feature

Reduce97.mdb ( expert )
This was originally designed as a way to delete large amounts of data from very large databases.

RemoveDuplicates.mdb ( beginner )
Illustrates a method for removing duplicate records from a table.

RemoveSpaces.mdb ( beginner )
This sample removes the spaces and carriage returns from text typed into the text box.

ReportInBackEndDatabase.mdb ( intermediate )
This sample illustrates how to run a report that exists in the Back-End database.

ResettingReportPageNumbers.mdb ( beginner )
This sample illustrates how to reset page numbers back to 1 for each group when grouping a report.

ReturnSQLfromQuery.mdb ( beginner )
This sample demonstrates how to read the SQL statement from a saved query using the .SQL property of the querydef object.

RoundingStuff.mdb ( beginner )
This sample shows a variety of rounding techniques, the most common being rounding to the nearest x decimal places. The function RoundIt is similar to the Round function in VB. All the code is stored in the basRounding module.

RunRemoteMacro.mdb ( intermediate )
This sample illustrates how to run a macro in a remote database to automate a process.


S

 

SaveFileToSpecificDirectory.mdb ( intermediate )
This sample shows how to use the Windows API to bring up the OpenSaveFile dialog box and save a file to a directory of your choosing.

SeekWithLinkedTable.mdb ( intermediate )
It is usually said that the Seek method cannot be used with a linked table. This is true, it cannot. However, it WILL work if you open the table in the remote database explicitly with the OpenDatabase method. This sample illustrates how to do this.

SelfJoin.mdb ( intermediate )
Demonstrates a number of ways to use a Self-Join in Access 97.

SetHyperlink.mdb ( intermediate )
This sample allows the user to double-click on a control, browse to a file, and save the filename in a field in a table.

SettingLabels.mdb ( intermediate )
This form gets the values of the labels from the Description of the Field in the table.

SigFigs.mdb ( beginner )
This example illustrates how to round a number to a specified number of significant figures.

SQLDAOLoader.mdb ( expert )
This sample shows how to modify the structure of a Back-End database using SQL DDL (data definition language) statements and DAO code. This sample does much the same as "SQLLoader.mdb", but does not require text files to hold the SQL. Further, it utiliz

SQLLoader.mdb ( expert )
This sample shows how to modify the structure of a Back-End database using SQL DDL (data definition language) statements. The actual code is found in the Back-end database (SQLLoaderBE.mdb).

StringStuff.mdb ( intermediate )
This sample illustrates a number of useful string functions. See the individual functions for details.

SubForm3Levels.mdb ( expert )
Access does not allow more than two levels of subforms. At times, however, your data model indicates the need for more levels. This is one way to implement a third level through the use of a list box.

SubformReference.mdb ( Beginner )
This sample illustrates how to reference controls on subforms and subsubForms. It also illustrates how to set the focus to these controls.

SubQuery.mdb ( beginner )
This sample illustrates how to use a Sub Query to return the Maximum value of a group and the values of the other fields associated with it.

SynchronizedSubforms.mdb ( beginner )
This sample illustrates how to keep two subforms synchronized with each other on a main form.


T

 

TooFewParameters.mdb ( beginner )
This sample illustrates two ways to open a DAO recordset based on a saved query with parameter values stored in a form.

TrainingRegistration.mdb ( intermediate )
This sample is a general purpose training registration database. It is a complete application which demonstrates many of the features of the other sample databases.

TwelveBalls.mdb ( beginner )
A fun problem in Nasty Nested IF statements


U

 

UIDesign.mdb ( intermediate )
Shows a variety of samples of good and bad User Interface design techniques.

Unbound.mdb ( intermediate )
This form illustrates how to use UNBOUND controls to add, delete, and edit records in a table using the DAO add/edit/update methods.

UnboundSQL.mdb ( intermediate )
This form illustrates how to use UNBOUND controls to add, delete, and edit records in a table using SQL statements, rather than the DAO add/edit/update methods.

UpdateDirect.mdb ( intermediate )
This sample illustrates how to programmatically update a table directly from a text file.

UpdateDirectFixed.mdb ( expert )
This sample illustrates how to programmatically update a table directly from a FIXED WIDTH text file.

UpdateImportSeekFind.mdb ( intermediate )
This sample illustrates how to programmatically update a table from a temp table.

UpdateRemote.mdb ( expert )
This sample illustrates how to run an update to a Back End (BE) database remotely for performance reasons.

UpdateWStatus.mdb ( intermediate )
This database illustrates two things: 1) How to update a table programmatically with values from another table and 2) how to implement a pop-up status meter.

UserSeesOnlyHisRecords.mdb ( beginner )
This sample shows how you can restrict data being displayed to just those records that match the user's network Login ID.


V

 

VacationUsed.mdb ( beginner )
This sample illustrates one way to dynamically calculate Vacation Days Available


Y

 

YearsMonthsDays.mdb ( intermediate )
Below are a variety of functions created by different developer's to calculate the difference between two dates, which can also be used for Age Calculations. Some work in some situations and not in others. You'll have to decide which is best.


Z

 

Zip97.mdb ( intermediate )
This sample was created before the advent of WinZip in an attempt to automate the compression process. It uses a DOS version of PKZIP an Zip2Exe. It will also create an self-extracting zip file.


 

Home