Results 1 to 3 of 3
  1. #1
    Lounger
    Join Date
    Sep 2006
    Location
    Jhongli, Taiwan
    Posts
    42
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I use an option group on a small navigation form (frmSelectCounselSheetClassroomSwitchboard) as a prompt to open one of the 2 available counseling reports using the following code:

    Private Sub cmdOK_Click()
    On Error GoTo Err_CommandOK_Click

    Select Case Me!fraReportToOpen
    Case 1
    DoCmd.OpenReport "REPORTWeeklyFirstSchoolCounselSheet", acViewReport, "", "", acNormal
    DoCmd.Close acForm, "frmSelectCounselSheetClassroomSwitchboard"
    Case 2
    DoCmd.OpenReport "REPORTWeeklySecondSchoolCounselSheet", acViewReport, "", "", acNormal
    DoCmd.Close acForm, "frmSelectCounselSheetClassroomSwitchboard"

    End Select

    Exit_CommandOK_Click:
    Exit Sub

    Err_CommandOK_Click:
    MsgBox Err.Description
    Resume Exit_CommandOK_Click

    End Sub


    Both the REPORTWeeklyFirstSchoolCounselSheet and REPORTWeeklySecondSchoolCounselSheet reports are based on separate parameter queries that prompt the User to enter a date for the counsel items for that particular week (just a single date entry).

    The code works fine as it is. However, does anyone out there know what code I can use in order to to add a 3rd option to the navigation form's option group in order to PRINT both reports at once BUT ONLY NEED TO ENTER THE DATE PARAMETER ONCE? (I realize this may involve changing the underlying parameter query for both of the reports).

    Access 2007 running on Win7 (32)
    Thanks for any assistance you can give me!

  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
    I would add a textbox control to your form, and have the user enter the date there. Then modify your queries to reference this control. Your code in your form would then me modified to this:

    Code:
    Select Case Me!fraReportToOpen
    Case 1
       DoCmd.OpenReport "REPORTWeeklyFirstSchoolCounselSheet", acViewReport, "", "", acNormal
    Case 2
       DoCmd.OpenReport "REPORTWeeklySecondSchoolCounselSheet", acViewReport, "", "", acNormal
    case 3
       DoCmd.OpenReport "REPORTWeeklyFirstSchoolCounselSheet", acViewReport, "", "", acNormal
       DoCmd.OpenReport "REPORTWeeklySecondSchoolCounselSheet", acViewReport, "", "", acNormal
    
    End Select
    DoCmd.Close acForm, "frmSelectCounselSheetClassroomSwitchboard"
    Mark Liquorman
    See my website for Tips & Downloads and for my Liquorman Utilities.

  3. #3
    Lounger
    Join Date
    Sep 2006
    Location
    Jhongli, Taiwan
    Posts
    42
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you Mark, it works great! I'm sure you know but FYI for everyone else who views this thread...

    DoCmd.OpenReport "REPORTWeeklyFirstSchoolCounselSheet", acViewNormal, "", "", acHidden

    ...enables you to print the report directly without having the extra usually useless step of the Print dialog box appearing.
    Thanks again!

Posting Permissions

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