Hi,
I wish to convert my code below, to 'Select Case' but I am not having any joy, so I need help with this please.
I have 'HomePhone' field where phone number is entered as a sequence of numbers. on the AFTERUPDATE statement, my code applies appropriate formatting for the type of number eg mobile or international etc.
I need to add more options but 'IF THEN' becomes rather messy.
Alternative suggestions will be considered.
Best Regards
I wish to convert my code below, to 'Select Case' but I am not having any joy, so I need help with this please.
I have 'HomePhone' field where phone number is entered as a sequence of numbers. on the AFTERUPDATE statement, my code applies appropriate formatting for the type of number eg mobile or international etc.
I need to add more options but 'IF THEN' becomes rather messy.
Alternative suggestions will be considered.
Best Regards
Code:
txtField = me.HomePhone
If Mid(txtField, 1, 3) = "020" Then
txtField = Mid(txtField, 1, 3) & "-" & Mid(txtField, 4, 4) & "-" & Mid(txtField, 8, 4)
Else
If Mid(txtField, 1, 2) = "00" Then
txtField = Mid(txtField, 1, 4) & "-" & Mid(txtField, 5, 3) & "-" & Mid(txtField, 8, 3) & "-" & Mid(txtField, 11, 4)
Else
txtField = Mid(txtField, 1, 5) & "-" & Mid(txtField, 6, 3) & "-" & Mid(txtField, 9, 3)
End If
End If
Comment