Results 1 to 5 of 5
  1. #1
    New Lounger
    Join Date
    Nov 2006
    Location
    Sydney, New South Wales, Australia
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Using an Unbound Option Group for Report Selection (Access2000)

    A question I am hoping for help on:
    I have an option group on a form that does not have a control source. I want to use to the option group for users to make a report selection then click a button that will then preview the report that has been selected. The macro that I have assigned to the button is set up with the condition column enabled and I have placed the following text in the condition column: [selection]=1 I have then placed in the Action column an Open Report, with the Report Name and View both specified. I believe I have the Option Values set up correctly, but I am receving an error message that says "The object doesn't contain the Automation object 'selection' ".
    Do I need to refer to the name of the Option Group somewhere in the macro?
    Thanks

  2. #2
    Platinum Lounger
    Join Date
    Feb 2002
    Location
    A Magic Forest in Deepest, Darkest Kent
    Posts
    5,681
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: Using an Unbound Option Group for Report Selec

    Common area I have found when teaching this is the option group is named wrong. Have a look at the screen dump and use this as a framework for this type of problem.

    The prev is attached to a command button to preview and the print is to the print option
    Jerry

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

    Re: Using an Unbound Option Group for Report Selection (Access2000)

    Welcome to Woody's Lounge!

    Jezza has already pointed out how to do this in a macro.
    I never use macros for this kind of thing; VBA code is much easier to debug and maintain. Code would look like this:

    Private Sub cmdReport_Click()
    Dim strReport As String
    Select Case Me.OptionGroupName
    Case 1
    strReport = "rptReport1"
    Case 2
    strReport = "rptReport2"
    Case 3
    strReport = "rptReport3"
    End Select
    DoCmd.OpenReport strReport, acViewPreview
    End Sub

    You must, of course, substitute the correct names.

  4. #4
    New Lounger
    Join Date
    Nov 2006
    Location
    Sydney, New South Wales, Australia
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Using an Unbound Option Group for Report Selec

    Thanks Jerry. That was exactly the problem.
    CAB

  5. #5
    New Lounger
    Join Date
    Nov 2006
    Location
    Sydney, New South Wales, Australia
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Using an Unbound Option Group for Report Selection (Access2000)

    Thanks Hans, I don't have a great knowledge of VBA, but I will give it a shot.
    CAB

Posting Permissions

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