Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Use part of a text string to populate another text box

Status
Not open for further replies.
May 5, 2000
168
US
On my form, I will be requiring a SSN (social security number). I have another text box that will contain the last four characters of the SSN (text field).

How can I automatically populate the four character field from the text in the full SSN.
 
the last four characters
Take a look at the Right function.

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Here's the code:

Private Sub SSN_AfterUpdate()
Dim AnyString, MyStr
AnyString = Me![SSN]

MyStr = Right(AnyString, 4)

If Me![SSN] > "" Then
Me![SSNShort] = MyStr
End If

End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top