I have a form with a textbox that stores a phone number. In order to be user friendly, I want to be able to account for the possibility of entering phone numbers with the standard nine numbers (areacode+phonenumber), 1+areacode+phonenumber, 1+areacode+phonenumber+extension, and areacode+phonenumber+extension; all with an input mask for easy readability. I can set the input mask in the afterupdate function of the textbox with no problem according to the following code:
'Set input mask to reflect correct phone number.
If Left(phonenum,1)=1 And Len(phonenum)>10 then
Me!phonenum.inputmask="9-999-999-9999-99999"
ElseIf Left(phonenum,1)=1 then
Me!phonenum.inputmask="9-999-999-9999"
ElseIf Left(phonenum,1)<>1 and Len(phonenum)>10 then
Me!phonenum.inputmask="999-999-9999-99999"
Else
Me!phonenum.inputmask="999-999-9999"
End If
My problem is when I retrieve records through the navigation bar, the input mask is lost. I've tried setting the same code in the form activate and form load sections, but cannot get it to work. Any suggestions on how to do this? Thanks in advance.
'Set input mask to reflect correct phone number.
If Left(phonenum,1)=1 And Len(phonenum)>10 then
Me!phonenum.inputmask="9-999-999-9999-99999"
ElseIf Left(phonenum,1)=1 then
Me!phonenum.inputmask="9-999-999-9999"
ElseIf Left(phonenum,1)<>1 and Len(phonenum)>10 then
Me!phonenum.inputmask="999-999-9999-99999"
Else
Me!phonenum.inputmask="999-999-9999"
End If
My problem is when I retrieve records through the navigation bar, the input mask is lost. I've tried setting the same code in the form activate and form load sections, but cannot get it to work. Any suggestions on how to do this? Thanks in advance.