Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21292

[RESOLVED] how do i create a function that deletes a table each month?

$
0
0
i have a table of punch clock that users punches in and out everymonth
now i want that every new month the list will be cleared from the earlier month
e.x from 1 of january until end of january i see the times that the users loged in and out
when february comes then the list gets empty and they start to punch in the new month and so on
this is the table that i need to delete each month
Code:

TableName EnterWork
values
EnterDate date/time
EnterDay Text
EnterName Text
EnterIN Date/Time
EnterOut Date/Time
EnterTotal Number

i have a function that do a similar thing but it is everyday not everymonth
Code:

  Dim NewID As Long
    Dim strSQL As String
    Dim rs As New ADODB.Recordset
    Dim DateToday As Date
    DateToday = CDate(Date & " 00:01")
    Set rs = CN.Execute("SELECT * FROM TempCash ORDER BY TempDate")
    While Not rs.EOF
        If rs!TempDate < DateToday Then
          CN.Execute "delete From TempCash where TempDate < #" & MyDate(DateToday) & "#"

        End If
        rs.MoveNext
    Wend
End Function

tnx in advanced
salsa31

Viewing all articles
Browse latest Browse all 21292

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>