Demo DB

elliot315

Mr. Question
Local time
Today, 13:34
Joined
Jun 3, 2007
Messages
98
How to create a demo db.. I want to limit the use to 100 records, how do I accomplish this?
 
Just check the record count property each time the user tries to add a record. If the record count > 100, then put up a message box.

Code:
Function AllowNewRecord() As Boolean

    Dim rsCheck As ADODB.Recordset

    Set rsCheck = New ADODB.Recordset

    rsCheck.Open "SELECT * FROM YourTableNameHere;",CurrentProject.Connection, adOpenKeyset, adLockReadOnly
    rsCheck.MoveLast
    rsCheck.MoveFirst

    Select Case rxCheck.RecordCount
        Case < 100
	    AllowNewRecord = True	
    	Case Else
            AllowNewRecord = False
    End Select

    rsCheck.Close
    Set rsCheck = Nothing

End Function

Then, just call that function before writing a new record:

Code:
If AllowNewRecord Then
    --- your code for adding a new record here ---
Else
    --- some message telling the user that the demo version is full ---
End If
 

Users who are viewing this thread

Back
Top Bottom