Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access DEMO 2

Status
Not open for further replies.

tomcat21

Programmer
Jul 28, 2002
69
US
I distribute an application as a DEMO and as an .mde file. I use a Date that is located in a Module to restrict access after a specified date.
My worry is that the user can just back date their computer to get around this.
My question:
What is an EASY way to limit the number of record entries (ex. 50 records)?
Could you explain in Detail, I am not that good with code.

Thanks

Thomas Bailey
tomcat@reportcop.com
 
This is one way of doing it. Put this code in the first field in the AfterUpdate event. It will remind the user how many records he can enter. When he tries to exceed 50, it will remind him and close the program. You must have the DAO reference installed. (Go to the code window and click on tools:reference and look for Microsoft DAO3.6 object library.)

Public Sub CountRec()
Dim rst As Recordset
Dim db As Database
Dim rec As Integer

Set db = CurrentDb

Set rst = db.OpenRecordset("Select * from [YourTableName]")
rst.MoveLast
rec = rst.RecordCount
If rec > 50 Then
MsgBox "You have exceded the number of entries in this demo_
Edition. Please purchse a registered copy."
DoCmd.Close
Exit Sub
End If
rec = 50 - rec
MsgBox "You may enter another " & rec & " records in this_
trial edition."
End Sub
 
Hi,
This way I am stopping user more than 10 entries.
My Command Button from the main form opens a form in add mode. You can modify this if you are adding the new record in the same form
Code:
Private Sub cmdNew_Click()
On Error GoTo Err_cmdNew_Click

    Dim stDocName As String
    Dim stLinkCriteria As String
    
    If Me.RecordsetClone.RecordCount >= 10 Then
     MsgBox "You can't add more than 10 contacts" '
     DoCmd.GoToRecord , , acLast
     
    Else

    stDocName = "frmAddEdit"
    DoCmd.OpenForm stDocName, , , , acFormAdd, acDialog
    Me.Requery
    End If
Exit_cmdNew_Click:
    Exit Sub

Err_cmdNew_Click:
    MsgBox Err.Description
    Resume Exit_cmdNew_Click
    
End Sub
Regards

Zameer Abdulla

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top