Results 1 to 10 of 10
  1. #1
    Join Date
    Mar 2003
    Location
    Brampton, Ontario, Canada
    Posts
    27

    Unanswered: Print reports automatically???

    I have several reports that the I would like to print automatically
    on a certain day/time.
    i.e. ReportOne - print every Friday at 3PM
    ReportTwo - Print every Monday at 10AM

    However, because the business is Seasonal, I only need this
    setup for 2 or 3 months of the year.
    How would I go about setting up a form so that a user
    could turn automatic printing on & off for specific reports
    and maybe even choose the date and time for printing.
    I'm not even sure this can be done.
    Can someone please advise me.

  2. #2
    Join Date
    Jul 2003
    Posts
    25
    Have you found a solution to your inquiry? If not, I have a few ideas and some code for you.

  3. #3
    Join Date
    Mar 2003
    Location
    Brampton, Ontario, Canada
    Posts
    27
    Your the first & only person to respond.
    Feel free to share any solutions or advice.
    Thanks
    Originally posted by tibbsy
    Have you found a solution to your inquiry? If not, I have a few ideas and some code for you.

  4. #4
    Join Date
    Jul 2003
    Posts
    25
    I do not know the entire dynamics of the situation such as do these reports need to be viewed in the off-season? What kind of programs are you running that you need to accomplish this with? If you are using access you can use the on timer event and simple if statments to check the dates and time. The program can gather this information from the systems clock. Here's the other thing, is the computer with the database shut down during the times you need the report to print?

  5. #5
    Join Date
    Aug 2003
    Location
    SW Ohio
    Posts
    198

    Re: Print reports automatically???

    Originally posted by BradCO
    I have several reports that the I would like to print automatically
    on a certain day/time.
    i.e. ReportOne - print every Friday at 3PM
    ReportTwo - Print every Monday at 10AM

    However, because the business is Seasonal, I only need this
    setup for 2 or 3 months of the year.
    How would I go about setting up a form so that a user
    could turn automatic printing on & off for specific reports
    and maybe even choose the date and time for printing.
    I'm not even sure this can be done.
    Can someone please advise me.
    Assuming that you are opening a form when the database opens.......
    Put an on-load events that says
    if cstr(Now()) = cstr(reportone's date/time) then
    docmd.OpenReport "reportone",acViewNormal
    docmd.Quit acQuitSaveAll
    endif
    if cstr(Now()) = cstr(reporttwo's date/time) then
    docmd.OpenReport "reporttwo",acViewNormal
    docmd.Quit acQuitSaveAll
    endif


    Then on a server/perm WS create a scheduled task that fires up the database at the scheduled time. You can put a start date and end date on the scheduled task. That way the end user just has to reschedule it for the next year's run.
    Jim P.

    Supoorting Oracle, MSSQL7, Sybase 8, & Pervasive. Confusion Reigns

  6. #6
    Join Date
    Mar 2003
    Location
    Brampton, Ontario, Canada
    Posts
    27
    Originally posted by tibbsy
    I do not know the entire dynamics of the situation such as do these reports need to be viewed in the off-season? What kind of programs are you running that you need to accomplish this with? If you are using access you can use the on timer event and simple if statments to check the dates and time. The program can gather this information from the systems clock. Here's the other thing, is the computer with the database shut down during the times you need the report to print?
    I am using Access2000 and yes the reports will be run during the off season, but this can be done manually(as they are now). The system is alwasy running. I've never used the timer events before.
    How do I use the timer event to set a particular date and time
    i.e. every Friday at 3PM

  7. #7
    Join Date
    Mar 2003
    Location
    Brampton, Ontario, Canada
    Posts
    27

    Re: Print reports automatically???

    Originally posted by jimpen
    Assuming that you are opening a form when the database opens.......
    Put an on-load events that says
    if cstr(Now()) = cstr(reportone's date/time) then
    docmd.OpenReport "reportone",acViewNormal
    docmd.Quit acQuitSaveAll
    endif
    if cstr(Now()) = cstr(reporttwo's date/time) then
    docmd.OpenReport "reporttwo",acViewNormal
    docmd.Quit acQuitSaveAll
    endif


    Then on a server/perm WS create a scheduled task that fires up the database at the scheduled time. You can put a start date and end date on the scheduled task. That way the end user just has to reschedule it for the next year's run.
    Please forgive my ignorance Jim,
    but what does cstr mean or refer to.

  8. #8
    Join Date
    Nov 2002
    Location
    Melbourne
    Posts
    92
    This example uses the CStr function to convert a numeric value to a String

    I got this from Access help.

  9. #9
    Join Date
    Jul 2003
    Posts
    25
    Private Sub Form_Load()
    TimerInterval = 10000
    End Sub

    Private Sub Form_Timer()
    If (Date > Me![NeedByDate] And Date < Me![DOA]) Then
    DoCmd.OpenReport "AvailableProduct", acViewNormal
    End If

    End Sub

    The timer interval sets up how often the timer event will run from the time the form opens. I was slow responding because no matter whose code you want to use, the form has to be open at the specific time you want to run the reports. The timer interval is setup in milleseconds, so my example has the report printing every ten seconds. My timer interval is actually over 86,000,000, but I shortened it so it would be easier to test. The dates can either be programmed in or entered on the form for the current season. I am currently looking into coding options for you that wouldn't necessarily require the form to stay open on a computer all day.

  10. #10
    Join Date
    Jul 2003
    Posts
    25
    I think this code will be better suited for you because you can implement more than one if statement and open multiple reports. Again, the form has to be open. If a sure way of opening a form without restarting the database or writing a script, let me know.

    Private Sub Form_Load()
    TimerInterval = 30000
    End Sub

    Private Sub Form_Timer()
    If (Date > Me![NeedByDate] And Date < Me![DOA]) Then
    If (Time > #4:59:00 PM# And Time < #5:01:00 PM#) Then
    DoCmd.OpenReport "AvailableProduct", acViewPreview
    End If

    End If

    End Sub

Posting Permissions

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