Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2003
    Location
    Raleigh, NC
    Posts
    183

    Red face Unanswered: Option Group........Pls Help

    I have use Option group for user to selct reports. And then i have "cmdPreview" button so once user clicks on the option button they would clikc on "cmdPreview" to view reports. I have wrote following code for that but it does't wrk right. What am i doing wrong here ?

    Private Sub cmdPreviewReports_Click()

    Dim StrRpt As String

    If Me.Opt1.OptionValue = 1 Then
    StrRpt = "rptCustomer"
    DoCmd.OpenReport StrRpt, acViewPreview
    End If


    If Me.Opt2.OptionValue = 2 Then
    StrRpt = "rptOrder"
    DoCmd.OpenReport StrRpt, acViewPreview
    End If

    End Sub
    Skharva

  2. #2
    Join Date
    Dec 2002
    Location
    Préverenges, Switzerland
    Posts
    3,740
    wrong? you are talking to the group as tho it was not a group
    ...and you are definitely typing too much.

    select case TheNameOfYourOptionGroupGoesHere
    case 1
    DoCmd.OpenReport "rptCustomer", acViewPreview
    case 2
    DoCmd.OpenReport "rptOrder", acViewPreview
    'etc for all the other options
    Case else
    msgbox "Select an option you fool!"
    end select
    currently using SS 2008R2

  3. #3
    Join Date
    Sep 2003
    Location
    Raleigh, NC
    Posts
    183

    Thumbs up

    Originally posted by izyrider
    wrong? you are talking to the group as tho it was not a group
    ...and you are definitely typing too much.

    select case TheNameOfYourOptionGroupGoesHere
    case 1
    DoCmd.OpenReport "rptCustomer", acViewPreview
    case 2
    DoCmd.OpenReport "rptOrder", acViewPreview
    'etc for all the other options
    Case else
    msgbox "Select an option you fool!"
    end select
    Thanks
    Skharva

Posting Permissions

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