Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / December 2005

Tip: Looking for answers? Try searching our database.

Printing a specified report

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
savv32 - 30 Dec 2005 19:35 GMT
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
Allen Browne - 31 Dec 2005 03:48 GMT
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

Signature

Allen Browne - Microsoft MVP.  Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

> Hello All.
> I am using ver 2003.
[quoted text clipped - 13 lines]
> Many Thanks and Happy Holidays
> Scott
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.