|
Prev: Compact and Repair Problem
Next: List box Full warning!
From: Raymond on 3 Jul 2008 20:16 Hi all, I have a textbox for telephone and fax nos. for which i added the input mask as telephone no. (999)-(999)-(9999) (the default no., that is...) The requirement is that if a no., say, +86-23-4455 has to be added, the format does not alllow it and writes the no. as +86-234-455. Also, it should not become +86-023-4455 as this becomes a different telephone no... How do I correct this problem...As far as i undrstnd, i'll go for a do while loop on the mask and when the appropriate condition arises, i can put the codes..but i am unable to do that..>>> Your help will be acknowledged....
From: strive4peace on 3 Jul 2008 21:17 Hi Raymond, the InputMask,as I understand it, is applied when you enter or change the data ... that said, you can 1. remove the mask 2. enter data how do you do this? make an unbound textbox to enter a phone number with any symbols on the AfterUpdate event, remove the mask from the phone textbox (make sure it is defined in the form, not at the table level), place the data in, save the record, then put the mask back Warm Regards, Crystal remote programming and training Access Basics 8-part free tutorial that covers essentials in Access http://www.AccessMVP.com/strive4peace * (: have an awesome day :) * Raymond wrote: > Hi all, > > I have a textbox for telephone and fax nos. for which i added the input mask > as telephone no. (999)-(999)-(9999) (the default no., that is...) The > requirement is that if a no., say, +86-23-4455 has to be added, the format > does not alllow it and writes the no. as +86-234-455. Also, it should not > become +86-023-4455 as this becomes a different telephone no... > > How do I correct this problem...As far as i undrstnd, i'll go for a do while > loop on the mask and when the appropriate condition arises, i can put the > codes..but i am unable to do that..>>> Your help will be acknowledged....
From: Raymond on 3 Jul 2008 22:28 Hey, i didn;t understand how we can accept the record from the user after disabling the mask..what's the command??/ me.phonetextbox.inputmask=false ????????????????????????? What comes here??????????? me.phonetextbox.inputmask=true
From: strive4peace on 3 Jul 2008 23:49 Hi Raymond, you would do something like this in the AfterUpdate event of the UNBOUND textbox to create a phone number: '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ On Error GoTo Proc_Err Dim mPhone As String If Len(Trim(nz(controlname_UnboundPhone,""))) = 0 Then GoTo Proc_Exit End If Me.Phone.InputMask = "" Me.Phone = controlname_UnboundPhone ' clear unbound phone control Me.controlname_UnboundPhone = null 'save the record me.dirty = false Me.Phone.InputMask = "!\(999"") ""000\-0000;0;_" Proc_Exit: Me.Phone.SetFocus Exit Sub Proc_Err: MsgBox Err.Description, , _ "ERROR " & Err.Number _ & " PhonePaste" Resume Proc_Exit 'if you want to single-step code to find error, CTRL-Break at MsgBox 'then set this to be the next statement Resume '~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ WHERE controlname_UnboundPhone is the control NAME of your unbound phone number Phone is the control NAME of your phone number theoretically this should work ... ~~~~~~~~~~~ for better understanding of the basics of Access, read this: Access Basics 8-part free tutorial that covers essentials in Access http://www.AccessMVP.com/strive4peace Warm Regards, Crystal remote programming and training * (: have an awesome day :) * Raymond wrote: > Hey, i didn;t understand how we can accept the record from the user after > disabling the mask..what's the command??/ > > me.phonetextbox.inputmask=false > ????????????????????????? What comes here??????????? > me.phonetextbox.inputmask=true >
|
Pages: 1 Prev: Compact and Repair Problem Next: List box Full warning! |