+ Reply to Thread
Results 1 to 6 of 6

UserForms - making responses mandatory

  1. #1
    Zani
    Guest

    UserForms - making responses mandatory

    I am doing a project which involves collecting H&S data, via a series of
    UserForms, and dumping all the information into a worksheet for further
    reporting etc.

    My current stumbling block is how to make certain fields on the UserForm
    mandatory, so that they have to be filled in by the user before they can
    close down the form?

    Any ideas will be hugely appreciated - it's getting late and I can't sleep
    not knowing this!!!
    --
    Zani
    (if I have posted here, I really am stuck!)


  2. #2
    Bob Phillips
    Guest

    Re: UserForms - making responses mandatory

    Just add a close button to the userform and test in ther. Something like

    Private Sub cmdClose_Click()
    With TextBox1
    If .Text = "" Then
    MsgBox "Invalid data"
    .SetFocus
    Else
    Me.Hide
    End If
    End With
    End Sub

    --

    HTH

    RP
    (remove nothere from the email address if mailing direct)


    "Zani" <[email protected]> wrote in message
    news:[email protected]...
    > I am doing a project which involves collecting H&S data, via a series of
    > UserForms, and dumping all the information into a worksheet for further
    > reporting etc.
    >
    > My current stumbling block is how to make certain fields on the UserForm
    > mandatory, so that they have to be filled in by the user before they can
    > close down the form?
    >
    > Any ideas will be hugely appreciated - it's getting late and I can't sleep
    > not knowing this!!!
    > --
    > Zani
    > (if I have posted here, I really am stuck!)
    >




  3. #3
    Zani
    Guest

    Re: UserForms - making responses mandatory

    Thanks Bob

    Does the trick, why is it always the most simple of things that cause the
    most grief!

    Thanks again!
    --
    Zani
    (if I have posted here, I really am stuck!)



    "Bob Phillips" wrote:

    > Just add a close button to the userform and test in ther. Something like
    >
    > Private Sub cmdClose_Click()
    > With TextBox1
    > If .Text = "" Then
    > MsgBox "Invalid data"
    > .SetFocus
    > Else
    > Me.Hide
    > End If
    > End With
    > End Sub
    >
    > --
    >
    > HTH
    >
    > RP
    > (remove nothere from the email address if mailing direct)
    >
    >
    > "Zani" <[email protected]> wrote in message
    > news:[email protected]...
    > > I am doing a project which involves collecting H&S data, via a series of
    > > UserForms, and dumping all the information into a worksheet for further
    > > reporting etc.
    > >
    > > My current stumbling block is how to make certain fields on the UserForm
    > > mandatory, so that they have to be filled in by the user before they can
    > > close down the form?
    > >
    > > Any ideas will be hugely appreciated - it's getting late and I can't sleep
    > > not knowing this!!!
    > > --
    > > Zani
    > > (if I have posted here, I really am stuck!)
    > >

    >
    >
    >


  4. #4
    MaC
    Guest

    Re: UserForms - making responses mandatory

    You can also try to insert Bob's code into forms QueryClose event sub, for
    example like this:

    ------
    Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)

    If Len(TextBox1) = 0 Then
    MsgBox "You have to insert value in TextBox1"
    Cancel = True
    End If

    End Sub
    ------

    This time user is not able to close form before filling Textbox1.

    Good luck

    MaC



    U¿ytkownik "Zani" <[email protected]> napisa³ w wiadomo¶ci
    news:[email protected]...
    > Thanks Bob
    >
    > Does the trick, why is it always the most simple of things that cause the
    > most grief!
    >
    > Thanks again!
    > --
    > Zani
    > (if I have posted here, I really am stuck!)
    >
    >
    >
    > "Bob Phillips" wrote:
    >
    > > Just add a close button to the userform and test in ther. Something like
    > >
    > > Private Sub cmdClose_Click()
    > > With TextBox1
    > > If .Text = "" Then
    > > MsgBox "Invalid data"
    > > .SetFocus
    > > Else
    > > Me.Hide
    > > End If
    > > End With
    > > End Sub
    > >
    > > --
    > >
    > > HTH
    > >
    > > RP
    > > (remove nothere from the email address if mailing direct)
    > >
    > >
    > > "Zani" <[email protected]> wrote in message
    > > news:[email protected]...
    > > > I am doing a project which involves collecting H&S data, via a series

    of
    > > > UserForms, and dumping all the information into a worksheet for

    further
    > > > reporting etc.
    > > >
    > > > My current stumbling block is how to make certain fields on the

    UserForm
    > > > mandatory, so that they have to be filled in by the user before they

    can
    > > > close down the form?
    > > >
    > > > Any ideas will be hugely appreciated - it's getting late and I can't

    sleep
    > > > not knowing this!!!
    > > > --
    > > > Zani
    > > > (if I have posted here, I really am stuck!)
    > > >

    > >
    > >
    > >

    >





  5. #5
    Zani
    Guest

    Re: UserForms - making responses mandatory

    Thanks! Lots of clever people in here!
    --
    Zani
    (if I have posted here, I really am stuck!)



    "MaC" wrote:

    > You can also try to insert Bob's code into forms QueryClose event sub, for
    > example like this:
    >
    > ------
    > Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
    >
    > If Len(TextBox1) = 0 Then
    > MsgBox "You have to insert value in TextBox1"
    > Cancel = True
    > End If
    >
    > End Sub
    > ------
    >
    > This time user is not able to close form before filling Textbox1.
    >
    > Good luck
    >
    > MaC
    >
    >
    >
    > U¿ytkownik "Zani" <[email protected]> napisa³ w wiadomo¶ci
    > news:[email protected]...
    > > Thanks Bob
    > >
    > > Does the trick, why is it always the most simple of things that cause the
    > > most grief!
    > >
    > > Thanks again!
    > > --
    > > Zani
    > > (if I have posted here, I really am stuck!)
    > >
    > >
    > >
    > > "Bob Phillips" wrote:
    > >
    > > > Just add a close button to the userform and test in ther. Something like
    > > >
    > > > Private Sub cmdClose_Click()
    > > > With TextBox1
    > > > If .Text = "" Then
    > > > MsgBox "Invalid data"
    > > > .SetFocus
    > > > Else
    > > > Me.Hide
    > > > End If
    > > > End With
    > > > End Sub
    > > >
    > > > --
    > > >
    > > > HTH
    > > >
    > > > RP
    > > > (remove nothere from the email address if mailing direct)
    > > >
    > > >
    > > > "Zani" <[email protected]> wrote in message
    > > > news:[email protected]...
    > > > > I am doing a project which involves collecting H&S data, via a series

    > of
    > > > > UserForms, and dumping all the information into a worksheet for

    > further
    > > > > reporting etc.
    > > > >
    > > > > My current stumbling block is how to make certain fields on the

    > UserForm
    > > > > mandatory, so that they have to be filled in by the user before they

    > can
    > > > > close down the form?
    > > > >
    > > > > Any ideas will be hugely appreciated - it's getting late and I can't

    > sleep
    > > > > not knowing this!!!
    > > > > --
    > > > > Zani
    > > > > (if I have posted here, I really am stuck!)
    > > > >
    > > >
    > > >
    > > >

    > >

    >
    >
    >
    >


  6. #6
    StevenM
    Guest

    Re: UserForms - making responses mandatory

    I would like to do the same - require certain cells in certain worksheets be
    mandatory. Where do I copy/paste these suggestions?
    -Steven

    "Zani" wrote:

    > Thanks! Lots of clever people in here!
    > --
    > Zani
    > (if I have posted here, I really am stuck!)
    >
    >
    >
    > "MaC" wrote:
    >
    > > You can also try to insert Bob's code into forms QueryClose event sub, for
    > > example like this:
    > >
    > > ------
    > > Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
    > >
    > > If Len(TextBox1) = 0 Then
    > > MsgBox "You have to insert value in TextBox1"
    > > Cancel = True
    > > End If
    > >
    > > End Sub
    > > ------
    > >
    > > This time user is not able to close form before filling Textbox1.
    > >
    > > Good luck
    > >
    > > MaC
    > >
    > >
    > >
    > > U¿ytkownik "Zani" <[email protected]> napisa³ w wiadomo¶ci
    > > news:[email protected]...
    > > > Thanks Bob
    > > >
    > > > Does the trick, why is it always the most simple of things that cause the
    > > > most grief!
    > > >
    > > > Thanks again!
    > > > --
    > > > Zani
    > > > (if I have posted here, I really am stuck!)
    > > >
    > > >
    > > >
    > > > "Bob Phillips" wrote:
    > > >
    > > > > Just add a close button to the userform and test in ther. Something like
    > > > >
    > > > > Private Sub cmdClose_Click()
    > > > > With TextBox1
    > > > > If .Text = "" Then
    > > > > MsgBox "Invalid data"
    > > > > .SetFocus
    > > > > Else
    > > > > Me.Hide
    > > > > End If
    > > > > End With
    > > > > End Sub
    > > > >
    > > > > --
    > > > >
    > > > > HTH
    > > > >
    > > > > RP
    > > > > (remove nothere from the email address if mailing direct)
    > > > >
    > > > >
    > > > > "Zani" <[email protected]> wrote in message
    > > > > news:[email protected]...
    > > > > > I am doing a project which involves collecting H&S data, via a series

    > > of
    > > > > > UserForms, and dumping all the information into a worksheet for

    > > further
    > > > > > reporting etc.
    > > > > >
    > > > > > My current stumbling block is how to make certain fields on the

    > > UserForm
    > > > > > mandatory, so that they have to be filled in by the user before they

    > > can
    > > > > > close down the form?
    > > > > >
    > > > > > Any ideas will be hugely appreciated - it's getting late and I can't

    > > sleep
    > > > > > not knowing this!!!
    > > > > > --
    > > > > > Zani
    > > > > > (if I have posted here, I really am stuck!)
    > > > > >
    > > > >
    > > > >
    > > > >
    > > >

    > >
    > >
    > >
    > >


+ 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