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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to limit the number of records??

Status
Not open for further replies.

seafmmu

Technical User
Sep 23, 2002
4
MY
hai all, I have a situation here. For a database for voice mail, I want to limit the number of messages to be recorded for each account. Is is possible to do so with Ms Access. If it is possible, can you all out there lend me a helping hand?
 
Hi

If You are in a form and the messages table is bound to it and limited to the account:

Me.RecordsetClone.MoveLast
If Me.recordsetClone.RecordCount > YourMaxNumber Then
msgbox "Too Many ....
End If

or

Dim Db AS Database
Dim Rs As DAO.Recordset
Dim strSQL as String
'
strSQL = "SELECT * FROM tblMessages WHere Account = '" & TheAccountInHere & "';"
Set Db = CurrentDb()
Set Rs = Db.OpenRecordset(strSQL)
If Rs.Recordcount > YourMAaxNumberHere THEN
msgbox "Too many"
Else
......
Ken Reay
Freelance Solutions Developer
Boldon Information Systems Ltd
UK
kenneth.reaySPAMNOT@talk21.com
remove SPAMNOT to use
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top