Results 1 to 6 of 6
  1. #1
    dccjr's Avatar
    dccjr is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2012
    Location
    Colorado Springs, CO
    Posts
    138

    Option Button If-Then statements

    I am having an issue with an If-Then statement that is based on the selection of an option (radio) button. The radio buttons are named: rdoSingle and rdoCompleteSet. They are in a frame named: SearchOptions. I keep getting " Run-time error:2427 You entered an expression that has no value." on the If statement.

    Here is the code:



    If rdoSingle.Value = True Then
    Select Case Me.cboFieldID.Value
    Case "Work Order #"
    strSQL = "SELECT RCAData.[WorkOrderNo] FROM RCAData ORDER BY RCAData.[WorkOrderNo] ASC;"
    DoCmd.RunSQL strSQL
    Me!cboIDNo.RowSource = strSQL

    It contains several more Case statements. Do I need to declare the buttons or group somewhere. If so, how? I can't find anything useful searching google. Any help would be greatly appreciated.

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    If they're in a frame, you test the value of the frame, not the options within.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    dccjr's Avatar
    dccjr is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2012
    Location
    Colorado Springs, CO
    Posts
    138
    Thanks, but I am completely new to this. What would be the syntax for the If statement to determine which button is selected?

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    Each button has an "Option Value" property. The value of the frame will be the Option Value of the selected option (or Null, if nothing has been selected). By default they'll be numbers 1-x, but that can be changed.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    dccjr's Avatar
    dccjr is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    Nov 2012
    Location
    Colorado Springs, CO
    Posts
    138
    Thank you so much for your help. Got it fixed.

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,530
    Happy to help!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. set option button to true
    By crowegreg in forum Forms
    Replies: 2
    Last Post: 06-29-2012, 11:36 AM
  2. sort option button
    By turk in forum Access
    Replies: 9
    Last Post: 03-08-2012, 03:16 PM
  3. Option/Radio Button Problem
    By benthamq in forum Forms
    Replies: 6
    Last Post: 09-16-2011, 09:48 AM
  4. Option Button with Negated Value
    By rohnds in forum Forms
    Replies: 3
    Last Post: 08-09-2010, 07:07 AM
  5. Problem on Option Button
    By cwwaicw311 in forum Forms
    Replies: 2
    Last Post: 02-10-2010, 10:44 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums