• Combining parameter entries on one option button

    Home » Forums » AskWoody support » Productivity software by function » MS Access and database help » Combining parameter entries on one option button

    Author
    Topic
    #474183

    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!

    Viewing 1 reply thread
    Author
    Replies
    • #1263336

      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"
    • #1263399

      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!

    Viewing 1 reply thread
    Reply To: Combining parameter entries on one option button

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: