PDA

Click to See Complete Forum and Search --> : masked edit control


Jessie
Nov 22nd, 1999, 11:55 AM
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).]

Keiko
Nov 22nd, 1999, 01:27 PM
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

Jessie
Nov 23rd, 1999, 03:17 AM
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 :)