One way would be to call a procedure in the AutoExec macro to check the Contacts Table to see if any records were entered or updated (however you want to judge your data) two or more weeks before the current date. Something like this:
In the calling procedure place this code:
Select Case NeedReport
Case True
Docmd.OpenReport "rptMyReport"
Case False
'Do nothing
end select
the NeedReport function looks like this:
Public Function NeedReport() as Boolean
Dim db as dao.database
dim rs as dao.recordset
dim strSql as string
strSql = "SELECT * From tblContacts WHERE [Record Date]<= (Date() - 14)"
Set db = currentdb()
set rs = db.openrecordset(strsql)
if rs.BOF or RS.EOF then
NeedReport = False
Set rs = nothing
end if
NeedReport = true
set rs = nothing
set db = nothing
end function
the Report is bound to a query that runs a query that has the same criteria as the openrecordset sql statement.
This all assumes that people will be opening and closing the application fairly regularly.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.