Results 1 to 3 of 3
  1. #1
    4 Star Lounger
    Join Date
    Jan 2002
    Location
    Brookings, South Dakota, USA
    Posts
    449
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Printed report log (Access 2k2 (as 2k) SP-2)

    Hi All,
    I use the following to generate a Print Log for work orders printed. This works just fine when printing from the work order form and clicking the print button to print that work order only. However, if there has been many records added, it is easier to add all the new records then print the work orders as a group. Then this doesn't work. If I use OpenReport with acViewPreview, only the first record gets logged and none else. If I use OpenReport with acViewNormal, then no record gets logged.
    What can I do to get a Print Log generated when doing a group print?
    Thank You.

    gdr
    ------------------------------------------------------
    Private Sub Report_Activate()
    Flag = 0
    End Sub

    Private Sub Report_Deactivate()
    Flag = -1
    End Sub

    Private Sub ReportHeader_Print(Cancel As Integer, PrintCount As Integer)

    Dim dbs As Database
    Dim rst As Recordset

    Set dbs = CurrentDb()
    Set rst = dbs.OpenRecordset("tblPrintedReports")

    Flag = Flag + 1

    'If the current value of Flag = 1, then a hard copy (or Print Preview) of the
    'report is printing, so add a new record to the history table.
    If Flag = 1 Then
    rst.AddNew
    rst!ReportName = "Work Order"
    rst!ConnectionID = [ConnectionID]
    rst!StudentFullName = [StudentFullName]
    rst!RoomCode = [RoomCode]
    rst!ConnectionDate = [ConnectionDate]
    rst!PrintDate = Now
    rst.Update
    Flag = 0
    End If

    End Sub

    'Use the following in a module to set Flag global

    Option Compare Database
    Global Flag
    -----------------------------------------
    <IMG SRC=http://www.wopr.com/w3tuserpics/gdrezek_sig.jpg>
    "Those who dance are considered insane by those who can't hear the music" - George Carlin

  2. #2
    Gold Lounger
    Join Date
    Jun 2001
    Location
    Crystal Beach, FL, Florida, USA
    Posts
    3,436
    Thanks
    1
    Thanked 34 Times in 34 Posts

    Re: Printed report log (Access 2k2 (as 2k) SP-2)

    Gary,

    I don't have a clue as to what you are doing. The only thing I can say is that whatever code you put in the ReportHeader gets executed only once, so I'm not sure how you can expect to process multiple WO with it.

    If the purpose is to add a record to the log when a WO has been previewed/printed, why not add code to see if this WO has already been added to the log, then add it if necessary. I'd put this in the groupheader for the WO.
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  3. #3
    4 Star Lounger
    Join Date
    Jan 2002
    Location
    Brookings, South Dakota, USA
    Posts
    449
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Printed report log (Access 2k2 (as 2k) SP-2)

    Hi Mark and Thank you,
    Yes I know that it will get executed only once and not each time a record is printed when doing a range of reports. That is what I have been trying to work around. I stated this very poorly in my post......my bad. <img src=/S/sorry.gif border=0 alt=sorry width=15 height=15>
    I guess I'd been hoping that something would be triggered somewhere to make a log that way. And I also know that the only way (at least to me <img src=/S/shrug.gif border=0 alt=shrug width=39 height=15> ) to really ensure that a report or reports have been printed, is to actually see the report in my hands.
    So, what I am doing now is appending the records (to who, for what and date/time stamps) to a table corresponding to the SQL statement I generate to filter the records to be printed. But you did give me an idea on how to check, using VBA, that if a record has been printed, to send up a flag asking if, indeed, that record needs to be printed again. <img src=/S/thumbup.gif border=0 alt=thumbup width=15 height=15>
    Thanks again.

    gdr
    <IMG SRC=http://www.wopr.com/w3tuserpics/gdrezek_sig.jpg>
    "Those who dance are considered insane by those who can't hear the music" - George Carlin

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •