G Guest Feb 20, 2004 #1 How can I make only part of a field default. I want the area code in a phone number to default?
J John Vinson Feb 21, 2004 #2 How can I make only part of a field default. I want the area code in a phone number to default? Click to expand... This isn't easily done in a Table - you can set the default to (say) 2080000000 but then you'll have to overtype the zeros, risking error. In a Form you can set the Default to (say) (208) with an Input Mask of (000)000-0000 You can then put the following code in the GotFocus event of the textbox: Private Sub txtPhone_GotFocus() Me!txtPhone.SelStart = 6 Me!txtPhone.SelLength = 8 End Sub This will fill in the area code and leave the insertion point at the next digit. You can back up and overtype the area code if need be.
How can I make only part of a field default. I want the area code in a phone number to default? Click to expand... This isn't easily done in a Table - you can set the default to (say) 2080000000 but then you'll have to overtype the zeros, risking error. In a Form you can set the Default to (say) (208) with an Input Mask of (000)000-0000 You can then put the following code in the GotFocus event of the textbox: Private Sub txtPhone_GotFocus() Me!txtPhone.SelStart = 6 Me!txtPhone.SelLength = 8 End Sub This will fill in the area code and leave the insertion point at the next digit. You can back up and overtype the area code if need be.
T Tim Ferguson Feb 21, 2004 #3 How can I make only part of a field default. Click to expand... If you think the area code is a different piece of information from the rest of the number, then it ought to be in its own field. Then it becomes easy to make the defaultvalue = "079" or whatever. HTH Tim F
How can I make only part of a field default. Click to expand... If you think the area code is a different piece of information from the rest of the number, then it ought to be in its own field. Then it becomes easy to make the defaultvalue = "079" or whatever. HTH Tim F