Hey guys! First time poster, many time reader.
I've got a function (Daily_Archive) that I need to run only once a day. I've decided the base fit for me is to have a table (Test_Date) contain the date the function was last run.
What I need it to do, to avoid duplicating data within the Db or causing other irritating problems, is to check the current date against the date in Test_Date, and perform the rest of the function if they do not equal. Presumably the date in Test_Date would always be the day before.
Here's the code i've pieced together thus far (but does not include the comparison logic).
I'm by no means a programmer, i've only put this much together by reading help files. I'm sure i've committed several coding atrocities, so be gentle!
thanks in advance.
Guy
I've got a function (Daily_Archive) that I need to run only once a day. I've decided the base fit for me is to have a table (Test_Date) contain the date the function was last run.
What I need it to do, to avoid duplicating data within the Db or causing other irritating problems, is to check the current date against the date in Test_Date, and perform the rest of the function if they do not equal. Presumably the date in Test_Date would always be the day before.
Here's the code i've pieced together thus far (but does not include the comparison logic).
Code:
Option Compare Database
Function Daily_Backup()
Dim CurrentDate As String
Dim dbDatabase As Object
Dim rstTest_Date As Object
CurrentDate = Date
CurrentDate = Format(CurrentDate, "MMDDYY")
Set dbDatabase = CurrentDb
Set rstTest_Date = dbDatabase.OpenRecordset("Test_Date")
rstTest_Date.Edit
rstTest_Date("Test_Date").Value = CurrentDate
rstTest_Date.Update
End Function
I'm by no means a programmer, i've only put this much together by reading help files. I'm sure i've committed several coding atrocities, so be gentle!
thanks in advance.
Guy