Number of Records
A nice approach for reducing functionality in a database application is to simply limit the number of records. After all, what good is a database where you can store only a few records? There are two ways to do this, one of which requires code and one that doesn't. The method that requires code is to use the BeforeUpdate event of a bound form. In this case, cancel the event when you exceed your pre-set maximum number of records, as shown in the following code:
' max number of records Private Const MAX_RECORDS As Long = 10 Private Sub Form_BeforeUpdate(Cancel As Integer) Dim n As Integer n = Nz(DCount("*", "tblAssets"), 0) If (n + 1 > MAX_RECORDS) Then Cancel = True MsgBox "Cannot add additional records in this edition of the database.", _ vbExclamation, "TRIAL VERSION" End If End Sub
The second technique is to use the validation rule property of an AutoNumber field in a particular table. For example, say that you have a field in a table called ID, which is an AutoNumber. Set the validation rule property of this table to <= 10 to prevent adding more than 10 records to the table.
This last technique is not bulletproof. The AutoNumber value is incremented on first edit, so if you begin inserting a record but undo the commit, the AutoNumber seed is still incremented. As a result, users may not be able to store 10 records in the table.
Limited Functionality
One of the easier ways to limit the use of an application is to simply not ship all of it. This can be challenging to do if there are dependencies between features of your application. You might also consider leaving user interface entry points to the missing features as advertisement for the full version.
In this tutorial:
- Deployment
- Creating an Automated Build
- Design the Form
- Retrieving Information from the Source Database
- Building the Application
- Creating the Target Database
- Set Build Properties on the Target Database
- Setting Build Properties on the Source Database
- Deleting Data from Tables
- Calculating the Version Number
- Handling Application Dependencies
- Updating References
- Testing Reference Fix-Up
- Late Binding
- Licensing Your Applications
- Number of Records
- Restricting the Number of Times an Application is Launched
- Registering an Application
- Creating a Registration Web Service
- Validate the Registration Using the Web Service
- Miscellaneous Deployment Scenarios
- Create the Client Application
- Testing the Versioning Server
- Re-Linking Tables Automatically
- Programmatically Creating DSNs
- Creating a User DSN
- Ensuring an Application Runs Locally