+ Reply to Thread
Results 1 to 8 of 8

How to check if there is an input if an option button is Yes

  1. #1
    Forum Contributor
    Join Date
    05-01-2015
    Location
    Kent, England
    MS-Off Ver
    2013
    Posts
    148

    How to check if there is an input if an option button is Yes

    Hi All

    i have created a form and want to use MsgBoxes to highlight missing data i have the text and combo boxes done with the following code:

    Please Login or Register  to view this content.
    I currently have this for each item i am sure there is a neater way of achieving this but it works.

    What i need to do now is check that a txtbox has been filled is an option button has been selected as Yes and to display a MsgBox if it hasn't.

  2. #2
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: How to check if there is an input if an option button is Yes

    So, if the Option Button has not been selected do you need to do any checks, or perhaps the user is not allowed to proceed?

    Posting a code snippet out of context does not help to clarify things. Please describe the exact sequence and all possible outcomes.

    It may be that the best thing to do is add the verification code to the 'OK' button (if there is one) but it would be best if you uploaded a sample workbook with your code as it stands.

  3. #3
    Forum Contributor
    Join Date
    05-01-2015
    Location
    Kent, England
    MS-Off Ver
    2013
    Posts
    148

    Re: How to check if there is an input if an option button is Yes

    Sorry

    So there is a yes and a no option button that are grouped, what i want is if the yes option button is selected (no is selected by default) then something must be entered into a text box. So not been able to move on would be good as it is all my verification code is at the end when the person inputting the data presses the save command button

    So in the picture if the yes option button was selected then i would require something in the Area Comb box and also something in the Abnormality txt box.
    Attached Images Attached Images

  4. #4
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: How to check if there is an input if an option button is Yes

    OK, I can't be specific based on an image but include the check
    Please Login or Register  to view this content.

  5. #5
    Forum Contributor
    Join Date
    05-01-2015
    Location
    Kent, England
    MS-Off Ver
    2013
    Posts
    148

    Re: How to check if there is an input if an option button is Yes

    Thanks that works so i understand now how that works, this has lead onto another fault. I am using a multi page form so when i press the save command button once finished i get a run time error if the missing item is on a different page to the one i am currently on. Do i need to tell it to look at each form page?

  6. #6
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: How to check if there is an input if an option button is Yes

    It shouldn't and it's impossible to say why it does. Uploading a sample workbook that illustrates the issue is the only way to get positive answers.

  7. #7
    Forum Contributor
    Join Date
    05-01-2015
    Location
    Kent, England
    MS-Off Ver
    2013
    Posts
    148

    Re: How to check if there is an input if an option button is Yes

    I have up loaded the file and a screen shot of the error code, it appears to be with setting the focus back to the missed cell, it works if on that page and if you remove that line of code but will not work if you are on a different page.

    I an opening the form using the command button on sheet 1 in the top left
    Attached Images Attached Images
    Attached Files Attached Files

  8. #8
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: How to check if there is an input if an option button is Yes

    You can't set focus to a control if it is hidden (as it will be if on an unselected page in a MultiPage control) - you'll have to select the correct page before setting focus to the control...

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] How to check if option button has been selected within a frame
    By SoulPrisoner in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-10-2013, 07:30 AM
  2. Storing user input through option button value in another worksheet row by row
    By NRMDU in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-25-2013, 05:38 PM
  3. Replies: 0
    Last Post: 08-02-2012, 11:41 AM
  4. Check Box / Option Button problem in Excel 2010
    By Sofistikat in forum Excel General
    Replies: 7
    Last Post: 09-23-2011, 12:03 AM
  5. Check if all option button groups have a value
    By ker9 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-04-2011, 11:02 AM
  6. Uncheck Check Box + check a option button using Command Button
    By Carlsbergen in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-21-2009, 03:09 AM
  7. Check AND uncheck an option button
    By pingwin77 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-14-2008, 09:38 PM
  8. Check > 1 Option Button
    By emea training 2 in forum Excel General
    Replies: 2
    Last Post: 02-09-2005, 05:55 AM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1