+ Reply to Thread
Results 1 to 11 of 11

program to display error message

  1. #1
    Forum Contributor
    Join Date
    04-21-2009
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    112

    program to display error message

    Hello,

    I need a program for my user form such that it displays an error message.
    I have created an user form with employee name ,task and remarks.

    I need a program in such a way if an user clicks the "submit" button without entering all the fields in the user form, an "error message" should be displayed.

    The submit button has to work only if all the fields are filled by the user.

    Please let me know the procedure

    Regards
    Alex

  2. #2
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: program to display error message

    Are the controls TextBoxes?
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  3. #3
    Forum Contributor
    Join Date
    04-21-2009
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    112

    Re: program to display error message

    Controls contains Textboxes and Combo boxes

  4. #4
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,444

    Re: program to display error message

    Why not disable the button untill the fields are completed?
    Cheers
    Andy
    www.andypope.info

  5. #5
    Forum Contributor
    Join Date
    04-21-2009
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    112

    Re: program to display error message

    All the controls will be enabled.The user has to fill all the fields. Even if the user leaves to fill one field and tries to click the submit button an error message like "Enter all the Fields" should display. this is my requirement.

    Expecting your answers.

  6. #6
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,444

    Re: program to display error message

    So in the button's click event add code to check the length of the text property for textboxes. And the Value property of the combo boxes.

    If any are not completed use

    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    04-21-2009
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    112

    Re: program to display error message

    Thanks Ande for your answer.

    Can anyone send the program for my requirement

  8. #8
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,444

    Re: program to display error message

    Please Login or Register  to view this content.
    Change names and text to suit
    Last edited by Andy Pope; 04-22-2009 at 07:57 AM.

  9. #9
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: program to display error message

    You could place this code in a Standard Module
    Please Login or Register  to view this content.
    Then use it in any UserForm by adding this to your submit button
    Please Login or Register  to view this content.

  10. #10
    Forum Contributor
    Join Date
    04-21-2009
    Location
    Canada
    MS-Off Ver
    Excel 2003
    Posts
    112

    Re: program to display error message

    Thank you very much.
    Its working fine

  11. #11
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: program to display error message

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

    Also an indication of which solution you used helps others.

+ 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.6.0 RC 1