Microsoft Office 2000/Visual Basic Programmer's Guide   

Self-Updating Solutions

Moving some of your solution's components to a user's workstation creates some administrative concerns. For example, when you need to modify a static object in your solution, such as the design of a form or code, you must have mechanisms in place for updating all affected components on each individual workstation.

This problem can be minimized by building your solution so that it checks for latest versions upon startup. For example, your solution's startup code can check the modification dates of static objects in the local database by using the DAO LastUpdated property (there is no comparable method of getting this information for all objects in a database when you use ADO) and comparing them to dates in a central database located on the server. Whenever a newer date is found on a server object, you can use code to automatically import the latest version of the object, keeping the local database up-to-date.

In Access 2000, the CurrentDb method of the Application object can be used to return a DAO Database object that refers to the current database. The CurrentDb method establishes a hidden reference to the DAO 3.6 object library. That is, when you use the CurrentDb method, you don't have to explicitly establish the reference by using the References command (Tools menu). You can then use the Database object to navigate down through the DAO object hierarchy to reference the object you want to check. For example, the following line of code returns the last time the Categories form in the Northwind sample database was updated:

Application.CurrentDb.Containers("Forms").Documents("Categories") _
   .LastUpdated

For more information about using the CurrentDb method and DAO, search the Microsoft Access Visual Basic Reference Help index for "CurrentDb method."

Note   It is possible to use the DateModified property of the ADOX Tables, Views, and Procedures collections to return dates for tables and queries, but not for other Access database objects.

You can also use database replication features to keep objects up-to-date by synchronizing them. For example, you can create replicas of the front-end database and distribute them to users. Then if you make changes to the original Design Master of the front-end database, you can synchronize the replicas to distribute updated objects. For more information about replication, see "Database Replication Solutions" later in this chapter.