VBA validation

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Pritul
    New Member
    • Feb 2006
    • 3

    VBA validation

    Im having a problem, its been sort of bugging me out.
    If a user does not enter a value in a textbox on a form, I want to display a erroe message. A sort of validation.

    I have tried loads of thing, one is:-

    If stockpricet.val ue = " " Then
    MsgBox "Value not entered"
    End If

    can any body help?

    Pritul
  • Mahi
    New Member
    • Feb 2006
    • 2

    #2
    U can check it on the text box leave event or on the submit button on the form

    Comment

    • Pritul
      New Member
      • Feb 2006
      • 3

      #3
      Thanx

      Originally posted by Mahi
      U can check it on the text box leave event or on the submit button on the form

      Well I tried to check it on the submit button, it just does not seem to work.

      What leave even, I havent seen that on VBA yet?

      Comment

      • Gautam Dasaka
        New Member
        • Jan 2006
        • 2

        #4
        If stockpricet.tex t = "" then
        Msgbox "No Value"
        endif

        or

        if stockpricet = "" then
        Msgbox "No Value"
        endif

        Perhaps these will work.

        Regards

        Comment

        • RioDog
          New Member
          • Jul 2006
          • 4

          #5
          Originally posted by Pritul
          Im having a problem, its been sort of bugging me out.
          If a user does not enter a value in a textbox on a form, I want to display a erroe message. A sort of validation.

          I have tried loads of thing, one is:-

          If stockpricet.val ue = " " Then
          MsgBox "Value not entered"
          End If

          can any body help?

          Pritul
          You need to do this in the before update event
          Try this
          if isnull textbox(name) then
          cancel = true
          msgbox.....
          set focus to textbox
          end if
          or this
          varible name = Trim$(txtbox(na me))
          If Len(variable) = 0 Then
          MsgBox
          Cancel = True
          end if

          Hope it helps!!!

          Comment

          Working...