Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Print report every 2 weeks

Status
Not open for further replies.

ind

Programmer
Mar 9, 2000
121
US
Is there a way to automatically print a report to follow up on leads every (2) weeks???????
 
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 = &quot;SELECT * From tblContacts WHERE [Record Date]<= (Date() - 14)&quot;
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.

Sorry it was long. Hope that helps.

Bob
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top