Reports - Recording date / time for printing

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I want to be able to print a "product order" report but i only want it to
include "products" that have been added since the last report was printed.
 
You'll need to store the date when the report was printed in a table, and
then retrieve it again before you print the report again

Dim MyFlter As String
MyFilter = "[DateFieldNameInTable] > #" & DlookUp("FieldName","TableName") &
"#"
Docmd.OpenReport "ReportName" , , , MyFilter
Docmd.RunSQL "UPDATE TableName SET TableName.FieldName = Date()"

===========================
Unless you have another way to track which records were last to be printed,
then use it.
For example a counter

Dim MyFlter As String, MaxRecord as Long
MaxRecord = DlookUp("FieldName", "TableName")
MyFilter = "[DateFieldNameInTable] > " & MaxRecord
Docmd.OpenReport "ReportName" , , , MyFilter
Docmd.RunSQL "UPDATE TableName SET TableName.FieldName = " & MaxRecord
 
Sorry but i dont realy understand.

I have created a table called "AviPrintDate" with the field name
"AviPrintDate", then i set this feilds default to Now(). So when this table
is opened it records the current date time.

I then created a botton "print avi report" and added the code
DoCmd.OpenTable "AviPrintDate"
DoCmd.Save
DoCmd.Close

Please Note that this report is based of a Querie.

In the querie i have set the criteria for the Date time to
< AviPrintDate.AviprintDate FROM AviPrintDate

But this does not work.
Any help would be appericated.

Ofer Cohen said:
You'll need to store the date when the report was printed in a table, and
then retrieve it again before you print the report again

Dim MyFlter As String
MyFilter = "[DateFieldNameInTable] > #" & DlookUp("FieldName","TableName") &
"#"
Docmd.OpenReport "ReportName" , , , MyFilter
Docmd.RunSQL "UPDATE TableName SET TableName.FieldName = Date()"

===========================
Unless you have another way to track which records were last to be printed,
then use it.
For example a counter

Dim MyFlter As String, MaxRecord as Long
MaxRecord = DlookUp("FieldName", "TableName")
MyFilter = "[DateFieldNameInTable] > " & MaxRecord
Docmd.OpenReport "ReportName" , , , MyFilter
Docmd.RunSQL "UPDATE TableName SET TableName.FieldName = " & MaxRecord

--
Good Luck
BS"D


Dave said:
I want to be able to print a "product order" report but i only want it to
include "products" that have been added since the last report was printed.
 
Back
Top