Results 1 to 3 of 3

Thread: masked edit control

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Nov 1999
    Location
    Calgary,Alberta, Canada
    Posts
    70

    Post

    lets try this again i created a mask edit contol mskPhone=(###)-###-####

    two problems that i need resolved
    first one is to clear the numbers after they
    are saved into a file

    second is getting a error message box to be promted when the user forgets to enter text or enters it incomplete. I have tried several ways but to no avail i thought this would work but not

    if mskphone <> "(###)-###-####" then
    msgbox"please enter a phone number ",vbexclamnation
    check_user_data=false
    exit function

    this works all the time even when it is enter properly

    [This message has been edited by Jessie (edited 11-23-1999).]

  2. #2
    Addicted Member
    Join Date
    Sep 1999
    Posts
    229

    Post


    Hi Jessie,

    Just now I've posted a reply for you, but now I can't find it.

    But anyway ...

    First problem, to clear the number :
    Just replace # with _ (underscore)

    mskphone = "(___)-___-____"

    Second problem,

    Dim blnSuccess As Boolean

    blnSuccess = True

    If (blnSuccess) And (mskPhone = "(___)-___-____") Then
    MsgBox "Please enter a phone number "
    blnSuccess = False
    End If

    If (blnSuccess) And Not ((IsNumeric(Mid$(mskPhone, 2, 3))) And _
    (IsNumeric(Mid$(mskPhone, 7, 3))) And _
    (IsNumeric(Mid$(mskPhone, 11, 4)))) Then
    MsgBox "Not complete"
    blnSuccess = False
    End If

    If (blnSuccess) Then
    MsgBox ("Ok")
    End If


    ps: for suggestion only

    Is it better to set
    mskPhone.Format = "(###)-###-####"
    mskPhone.Mask = "(999)-999-9999"

    Does it help ?

    Regards

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Nov 1999
    Location
    Calgary,Alberta, Canada
    Posts
    70

    Post

    Hi keiko

    the reason that you could not find the last reply i deleted it i thought i had it figured out but then when i reran the program it gave me the error meesage all the time even when the correct data was entered
    thanks I'll try your code

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width