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 - Limit Records

Status
Not open for further replies.

tomcat21

Programmer
Jul 28, 2002
69
US
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
 
Replace this:
MsgBox "You have exceded the number of entries in this demo_ "
Edition. Please purchse a registered copy."
By this:
MsgBox "You have exceded the number of entries in this demo[highlight]" _
& "[/highlight] Edition. Please purchse a registered copy."
And similarly:
MsgBox "You may enter another " & rec & " records in this[highlight]" _
& "[/highlight] trial edition."

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top