Results 1 to 3 of 3
  1. #1
    UT227 is offline Expert
    Windows 7 32bit Access 2013 32bit
    Join Date
    Feb 2016
    Posts
    581

    Printing report by date

    I am trying to have certificates printed. But I need them to be printed according to when the class was given. If a class was before 4/1/2019 I want a certain report printed. If it was after 4/1/2019, I want a different report printed. This was the code I tried:
    If (cboPassFail = 1) And ((Forms!frmTrainingRosterCloseOutAll!DOT) >= (4 / 1 / 2019)) Then
    DoCmd.OpenReport "rptTrainingCertDept2", acViewReport, "", "", acNormal
    DoCmd.RunCommand acCmdPrintPreview


    ElseIf (cboPassFail = 1) And ((Forms!frmTrainingRosterCloseOutAll!DOT) <= (4 / 1 / 2019)) Then
    DoCmd.OpenReport "rptTrainingCertDept", acViewReport, "", "", acNormal
    DoCmd.RunCommand acCmdPrintPreview
    Else
    Beep
    MsgBox "Printing a certificate requires a passing grade", vbOKOnly, ""
    End If


    Both printed rptTrainingCertDept2

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,825
    If DOT is exactly 4/1/2019, which report should print?

    I am surprised anything prints without error. Those date parameters are not correct syntax.

    If cboPassFail = 1 And Forms!frmTrainingRosterCloseOutAll!DOT >= #4/1/2019# Then

    Code is not behind frmTrainingRosterCloseOutAll?
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    UT227 is offline Expert
    Windows 7 32bit Access 2013 32bit
    Join Date
    Feb 2016
    Posts
    581
    That equal sign got passed me and I forgot about putting # with the date. Thanks, works great.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Printing of Report
    By Kundan in forum Programming
    Replies: 4
    Last Post: 11-30-2018, 11:02 PM
  2. Report printing extra pages of the same report.
    By khughes46 in forum Reports
    Replies: 5
    Last Post: 06-19-2014, 07:39 AM
  3. Printing report
    By undee69 in forum Forms
    Replies: 1
    Last Post: 06-26-2012, 08:10 PM
  4. Update date after printing documents
    By huongdl1987 in forum Forms
    Replies: 4
    Last Post: 06-12-2012, 03:22 PM
  5. Change date after printing report
    By dutyfree in forum Reports
    Replies: 4
    Last Post: 10-24-2011, 12:55 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums