Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2005
    Posts
    240

    Unanswered: Select an Option Group

    I have got two option groups on a form which link to various reports, 1 group is used to view them the other is used to print them.

    Is there any way to make sure that the user can only select the reports within one group and not both groups at the same time?

    Here's the code for the two groups if you need it:

    Code:
    Select Case fraReports
    Case 1
        DoCmd.OpenReport "rptOrg_Audit_Log", acViewPreview
    Case 2
        DoCmd.OpenReport "rptEmployerDetails", acViewPreview
    Case 3
        DoCmd.OpenReport "rptEmployerLiability", acViewPreview
    Case 4
        DoCmd.OpenReport "rptEmployerWorkPlacement", acViewPreview
    Case Else
        MsgBox "Select to either View or Print a Report.", vbExclamation
    End Select
    
    Select Case fraPrint
    Case 1
        DoCmd.OpenReport "rptOrg_Audit_Log", acViewNormal
    Case 2
        DoCmd.OpenReport "rptEmployerDetails", acViewNormal
    Case 3
        DoCmd.OpenReport "rptEmployerLiability", acViewNormal
    Case 4
        DoCmd.OpenReport "rptEmployerWorkPlacement", acViewNormal
    Case Else
        MsgBox "Select to either View or Print a Report.", vbExclamation
    End Select

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    How about one option group and two buttons (cmdPrint and cmdPreview):

    Code:
     
    Sub RunTheReport(RepOutput as Integer)
     
    Select Case fraReports
    Case 1
    	DoCmd.OpenReport "rptOrg_Audit_Log", RepOutput 
    Case 2
    	DoCmd.OpenReport "rptEmployerDetails", RepOutput 
    Case 3
    	DoCmd.OpenReport "rptEmployerLiability", RepOutput 
    Case 4
    	DoCmd.OpenReport "rptEmployerWorkPlacement", RepOutput 
    Case Else
    	MsgBox "Select to either View or Print a Report.", vbExclamation
    End Select
     
    End Sub
     
    Private Sub cmdPrint_Click()
    On Error GoTo Err_cmdPrint_Click
    
    Call RunTheReport acViewNormal
     
    Exit_cmdPrint_Click:
    	Exit Sub
    Err_cmdPrint_Click:
    	MsgBox Err.Description
    	Resume Exit_cmdPrint_Click
    	
    End Sub
     
    Private Sub cmdPreview_Click()
    On Error GoTo Err_cmdPreview_Click
    
    Call RunTheReport acViewPreview
     
    Exit_cmdPreview_Click:
    	Exit Sub
    Err_cmdPreview_Click:
    	MsgBox Err.Description
    	Resume Exit_cmdPreview_Click
    	
    End Sub
    It's impossible now for them to select both groups as there is only one - and a tidier form to boot

    HTH
    Testimonial:
    pootle flump
    ur codings are working excelent.

  3. #3
    Join Date
    Sep 2005
    Posts
    240
    That was my back up plan if I couldn't get it working with one button.

Posting Permissions

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