+ Reply to Thread
Results 1 to 7 of 7

Thread: Creating a warning if options are NOT selcted

  1. #1
    Registered User
    Join Date
    06-29-2010
    Location
    Boston, Massachusetts
    MS-Off Ver
    Excel 2010
    Posts
    95

    Creating a warning if options are NOT selcted

    Hello,

    I have a command button and two option buttons. I am trying to have a warning box appear when someone uses the command button without selecting either of the two options, option38 and option40.

    The command button loads a new item from the database. I want a warning to aleart the user that they have not selected either one of the required options before proceeding to a new item from the database.

    I built a warning box and have it set to pop up a reminder to double check the option boxes every time the command button is used, but this is tedious to the user.

    Any help appreciated.

  2. #2
    Valued Forum Contributor alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Lake County, Illinois
    MS-Off Ver
    MS Office 2010, 2007 and 2002
    Posts
    1,161

    Re: Creating a warning if options are NOT selcted

    Are the options bound to a field in a table? If so, make the field in the table required. Access will not let the record be saved or closed if an option is not selected. Also make sure that there is no default value for the options or this will not work.

    Alan

  3. #3
    Forum Guru davegugg's Avatar
    Join Date
    12-18-2008
    Location
    WI, US
    MS-Off Ver
    2007
    Posts
    1,879

    Re: Creating a warning if options are NOT selcted

    The actual code to test if an option button has been toggled is just a boolean test:

    If option38 = False then
    Is your code running too slowly?
    Does your workbook or database have a bunch of duplicate pieces of data?
    Have a look at this article to learn the best ways to set up your projects.
    It will save both time and effort in the long run!


    Dave

  4. #4
    Registered User
    Join Date
    06-29-2010
    Location
    Boston, Massachusetts
    MS-Off Ver
    Excel 2010
    Posts
    95

    Re: Creating a warning if options are NOT selcted

    Hello,

    I took your advice and tried making the field required. Because people import the data as an amended table to work on via Excel, it appears the requirement is causing an error and preventing the import to complete.

    Both option38 and option40 input a 1 or 2 into a check column on the data table.

    I did try it as a new table but it still allows me to enter a new search without selecting either option38 or option40 first...any other suggestions?

  5. #5
    Registered User
    Join Date
    06-29-2010
    Location
    Boston, Massachusetts
    MS-Off Ver
    Excel 2010
    Posts
    95

    Re: Creating a warning if options are NOT selcted

    Hi Dave- I assume that is only part of the code?

    It would be followed by a message box?

  6. #6
    Registered User
    Join Date
    06-29-2010
    Location
    Boston, Massachusetts
    MS-Off Ver
    Excel 2010
    Posts
    95

    Re: Creating a warning if options are NOT selcted

    Is this something that could handled with a validation code and if so could someone help me with the code structure?

    I need it to make something that will work even when the datatable is amended several times by importation of Excel files.

  7. #7
    Forum Guru davegugg's Avatar
    Join Date
    12-18-2008
    Location
    WI, US
    MS-Off Ver
    2007
    Posts
    1,879

    Re: Creating a warning if options are NOT selcted

    if option38 = False then
    msgbox "You didn't click option 38.",vbokonly
    exit sub
    Is your code running too slowly?
    Does your workbook or database have a bunch of duplicate pieces of data?
    Have a look at this article to learn the best ways to set up your projects.
    It will save both time and effort in the long run!


    Dave

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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.2.0