Format text box with check box

R

Rachel

Hi,
I have a text box (txtphone) into which a user enters a phone number. The
default format of txtphone is "00-0000-0000". I also have a check box
(chkmobile) which I want the user to tick if the phone number is a mobile
number. When chkmobile is ticked I want the format of txtphone to change to
"0000-000-000" and then if it is unticked change back to default
"00-0000-0000". Make sense?
Currently I have:

Private Sub txtPhone_afterupdate()
If chkMobile.Value = False Then
txtPhone.Value = Format(Me.txtPhone.Value, "00-0000-0000")
End If
End Sub

Private Sub chkmobile_click()
If chkMobile.Value = True Then
txtPhone.Value = Format(Me.txtPhone.Value, "0000-000-000")
End If
End Sub

When I enter a number into txt phone currently and tab out the format
changes to the default but ticking chkmobile does nothing.

Any help is greatly appreciated.
Rachel
 
R

Rachel

Sorry - duplicated question. Already answered, I just couldn't find the
original post.
Thanks :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top