Printing a specified report

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

Guest

Hello All.
I am using ver 2003.

I have a continous form which contains information regarding vendors bills
and i would like to create a check box (or a print button) which when
selected prints out a statement / report which shows the bill. Not only would
this check box print the bill but it would also count the number of timees
this has been done. For instance if the bill has been printed 3 times then i
would like in bold print "3rd Reminder". This reminder would be printed in
the top right corner of the bill.

Any and all help is greatly appreciated.

Many Thanks and Happy Holidays
Scott
 
For an example of how to print just one record, see:
Print the record in the form
at:
http://allenbrowne.com/casu-15.html

This thing about incrementing a counter for each record when it is printed
sounds inadequate. If a client questions you, you have no way of knowing at
what 3 dates it was actually printed and sent. Worse, it only take a paper
jam, someone turns the printer off and so you have to print it again, and
now are really are complaining to your good customers that this is a 2nd
reminder of their bill.

If this is important enough to do, you really need to create a related table
that stores which records were printed when. This table will hold fields:
BatchID number
BillID number

You can now execute an Append query statement to identify the records in the
print run. To get the SQL statement you need, mock up a query using any old
literal values, switch it to an Append query (Append on Query menu), and
then switch to SQL View (View menu) to see an example of the statement you
need to create.

You will end up with code something like this:
Dim strSql As String
Dim lngBatchID As Long

lngBatchID = Nz(DMax("BatchID", "tblPrintRun"),0) + 1
strSql = "SELECT INTO tblPrintRun (BatchID, BillID) " & _
"SELECT " & lngBatchID & " AS BatchID, BillID " & _
"FROM tblBill WHERE ...
With dbEngine(0)(0)
.Execute strSql, dbFailOnError
MsgBox .RecordsAffected & " record(s) in batch " & lngBatchID
End With

Once you are done, you can include this table in the query that supplies
records to your report, and set the criteria to one particlular print run
batch.

You can also know the number of previous print runs for the bill, with a
text box on the report. Its Control Source will be something like this:
=DCount("*", "tblPrintRun", "BillID = " & [BillID]) - 1
 
Back
Top