Help with numeric field, msgbox

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • rzito@si.rr.com

    #1

    Help with numeric field, msgbox

    I am looking for a technique with regards to the message displayed
    when you enter text into a numeric field. I obviously get the "The
    value entered isn't valid for this field" message how do I substitute
    this message for my own? I have tried before update (if
    notisnumeric(my field.text), keydown. But I can not get it to wok,
    thanks in advance!

  • storrboy

    #2
    Re: Help with numeric field, msgbox

    On Mar 10, 1:02 pm, r...@si.rr.com wrote:
    I am looking for a technique with regards to the message displayed
    when you enter text into a numeric field. I obviously get the "The
    value entered isn't valid for this field" message how do I substitute
    this message for my own? I have tried before update (if
    notisnumeric(my field.text), keydown. But I can not get it to wok,
    thanks in advance!

    I usually use the BeforeUpdate event. I think your example is written
    wrong..
    if notisnumeric(my field.text)

    should read

    If Not IsNumeric(Me!my field.Text) Then
    Msgbox "That's not a number dummy!"
    Cancel = True
    End If

    Also remember to check if the field is null or if necessary, some
    other value that may also be a number - like True and False.

    Comment

    • fredg

      #3
      Re: Help with numeric field, msgbox

      On 10 Mar 2007 10:02:43 -0800, rzito@si.rr.com wrote:
      I am looking for a technique with regards to the message displayed
      when you enter text into a numeric field. I obviously get the "The
      value entered isn't valid for this field" message how do I substitute
      this message for my own? I have tried before update (if
      notisnumeric(my field.text), keydown. But I can not get it to wok,
      thanks in advance!
      Here's how you can find the correct error and show your own message
      for any of the form level errors.

      First code the Form's Error event:

      MsgBox "Error#: " & DataErr ' Display the error number
      Response = acDataErrDispla y ' Display Default message

      Then open the form and intentionally make that error.

      The message box will display the error number and the default error
      message.

      Next, go back to the error event and change that code to:

      If DataErr = XXXX Then
      Response = acDataErrContin ue ' Don't display the default message
      MsgBox "Please enter a number only."
      Else
      MsgBox "Error#: " & DataErr
      Response = acDataErrDispla y ' Display Default message
      End If

      where XXXX is the error number.
      --
      Fred
      Please respond only to this newsgroup.
      I do not reply to personal e-mail

      Comment

      • rzito@si.rr.com

        #4
        Re: Help with numeric field, msgbox


        fredg , pretty cleaver, I tried to sniff out the error to trap with
        the Msgbox err.number but it was returning 0, thanks I can use the
        same for required fields as well!


        Comment

        • fredg

          #5
          Re: Help with numeric field, msgbox

          On 10 Mar 2007 10:02:43 -0800, rzito@si.rr.com wrote:
          I am looking for a technique with regards to the message displayed
          when you enter text into a numeric field. I obviously get the "The
          value entered isn't valid for this field" message how do I substitute
          this message for my own? I have tried before update (if
          notisnumeric(my field.text), keydown. But I can not get it to wok,
          thanks in advance!
          Here's how you can find the correct error and show your own message
          for any of the form level errors.

          First code the Form's Error event:

          MsgBox "Error#: " & DataErr ' Display the error number
          Response = acDataErrDispla y ' Display Default message

          Then open the form and intentionally make that error.

          The message box will display the error number and the default error
          message.

          Next, go back to the error event and change that code to:

          If DataErr = XXXX Then
          Response = acDataErrContin ue ' Don't display the default message
          MsgBox "Please enter data in all required fields."
          Else
          MsgBox "Error#: " & DataErr
          Response = acDataErrDispla y ' Display Default message
          End If

          where XXXX is the error number.
          --
          Fred
          Please respond only to this newsgroup.
          I do not reply to personal e-mail

          Comment

          Working...