table limits

  • Thread starter Thread starter andreja_zivkovich
  • Start date Start date
A

andreja_zivkovich

Guest
Hi everybody,

I want procedure - on Exit to delete all entries except the 2-3 major entries

Thanks in advance for your assistance.


Regards
 
Suggestion:

Open a Recordset and loop through it checking to see if the record is one you don't want to delete. You can then use the Delete Method of the Recordset to remove the unwanted records.

Code:
Public Sub DeleteUnwantedRecords()
Dim rst as ADODB.RecordSet
Set rst = New ADODB.RecordSet

rst.Open "SQL", CurrentProject.Connection, adOpenDynamic, adLockOptimistic

if rst.RecordCount=0 then Exit Sub

rst.MoveFirst

Do While Not rst.EOF
  If rst![FieldtoCheck]<>"the value you want to keep" Then
    rst.Delete
  End if
  rst.movenext
Loop

End Sub
 
Another way to go is to create a delete query, and then open it in the ON EXIT property with

docmd.openquery queryname

-Curt
 

Users who are viewing this thread

Back
Top Bottom