Results 1 to 5 of 5
  1. #1
    4 Star Lounger
    Join Date
    Mar 2005
    Location
    Leicestershire, United Kingdom
    Posts
    506
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Code for this? (2000)

    Hi,

    Wondering if you can hope. At the moment I have a table based on the following: -

    Date OldStatus NewStatus PropertyID Tag

    I have a report that runs based on the date being today; date()

    However sometimes if we have run the report say at 5pm and someone makes a new addition at 6pm and does not run the report. The next the activities start again, 8 entries happen the reports runs, but obviously that entry from 6pm does not have a date entry of today as it happened yesterday. How can I get round this? Any ideas?
    Best Regards,

    Luke

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Code for this? (2000)

    What would you prefer
    - The ability to run yesterday's report again, including both the records already printed and the ones added after 5 PM, or
    - The report includes all records that haven't been printed yet, including those entered yesterday after the previous run of the report.
    The latter would be more complicated.

  3. #3
    4 Star Lounger
    Join Date
    Mar 2005
    Location
    Leicestershire, United Kingdom
    Posts
    506
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Code for this? (2000)

    I think the latter is more fool proof for people.
    Best Regards,

    Luke

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Code for this? (2000)

    You could do the following:
    - Add a Yes/No field Printed to the table.
    - Create a query that selects all records with Date before today.
    - Select Query | Update Query.
    - Enter True in the 'Update to' line under the Printed field.
    - Run the query. (This is a one-time action)
    - Change the query that acts as record source of the report: remove the date criteria, add the Printed field and set its criteria to False
    - (If you set the where-condition for the report in the DoCmd.OpenReport line, change this instead)
    - Create a new query with the same criteria (Printed is False)
    - Select Query | Update Query.
    - Enter True in the 'Update to' line under the Printed field.
    - Save this query.
    - Run this query after printing the report. You can do this in code. To avoid the warnings "You are about to execute ...", you can use

    DoCmd.SetWarnings False
    DoCmd.OpenQuery "qryUpdate"
    DoCmd.SetWarnings True

  5. #5
    4 Star Lounger
    Join Date
    Mar 2005
    Location
    Leicestershire, United Kingdom
    Posts
    506
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Code for this? (2000)

    will have a stab at this and get back to you.
    Best Regards,

    Luke

Posting Permissions

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