Private Sub BtnMonthly_Click()
Dim MyDB As Database
Dim RstStoredMonth As Recordset
Set MyDB = CurrentDb
Set RstStoredMonth = MyDB.OpenRecordset("qrydatecurrentstored")
Dim MonthNow As String
Dim StoredMonth As String
Dim StoredDate As String
Dim MyDate, CurrentMonth
'get current date
MyDate = Now()
'get current month
CurrentMonth = Month(MyDate)
'traverse recordset to get stored date
With RstStoredMonth
.MoveFirst
StoredDate = .Fields("currentstoreddate").Value
End With
'get stored month
StoredMonth = Month(StoredDate)
Select Case StoredMonth
'table uptodate
Case StoredMonth = CurrentMonth
'AppendMonthly() 'append monthly data remmed out for now
'table needs appended snapshot
Case StoredMonth < CurrentMonth
Case Else
MsgBox ("should never be here contact pb, no append made")
End Select
Debug.Print CurrentMonth
Debug.Print StoredMonth
'AppendMonthly
End Sub
|