Option Compare Database
Option Explicit
Function sam0701()
Dim firsttmpseq As Integer
Dim dbs As Database
Dim rst As Recordset
Dim strSQL As String
Set dbs = CurrentDb()
strSQL = "SELECT * FROM [tmp];"
Set rst = dbs.OpenRecordset(strSQL)
rst.MoveFirst
firsttmpseq = rst!tmpseq
rst.Close
dbs.Close
DoCmd.RunSQL ("delete from tmp where tmpseq =" & firsttmpseq)
End Function
Function sam0702()
Dim lasttmpseq As Integer
lasttmpseq = DLast("tmpseq", "tmp")
DoCmd.RunSQL ("delete from tmp where tmpseq =" & lasttmpseq)
End Function
Function sam0703()
Dim dbs As Database
Dim rst As Recordset
Dim strSQL As String
Dim i As Integer
Set dbs = CurrentDb()
strSQL = "SELECT * FROM [tmp];"
Set rst = dbs.OpenRecordset(strSQL)
rst.MoveFirst
For i = 1 To 3
rst.Delete
rst.MoveNext
Next
rst.Close
dbs.Close
End Function
|