I distribute an Access Demo and I want to limit a user to no more than fifty (50) record entries in each form.
I have tried the below code that was supplied to me, but I can not get it to work. I am NOT good with code. I would very much appreciate an EASY way to do this.
Public Sub CountRec()
Dim rst As Recordset
Dim db As Database
Dim rec As Integer
Set db = CurrentDb
Set rst = db.OpenRecordset("Select * from [MyTableName]")
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
Thomas Bailey
tomcat@reportcop.com
I have tried the below code that was supplied to me, but I can not get it to work. I am NOT good with code. I would very much appreciate an EASY way to do this.
Public Sub CountRec()
Dim rst As Recordset
Dim db As Database
Dim rec As Integer
Set db = CurrentDb
Set rst = db.OpenRecordset("Select * from [MyTableName]")
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
Thomas Bailey
tomcat@reportcop.com