Need Help With VB,

jcamden's Avatar
Newbie Member
I am currently using a program called Speedy Schedule that allows us to book and keep track of patients in the office. Currently, the form requires the patients full SSN, we want it to only require the last 4 digits of the SSN and then be able to provide a list of patients that match those digits when doing a search. I would need to know what the correct syntax for that code might be. Currently our coding is as follows: Private Sub txtSSN_LostFocus() X = Right(txtSSN.Text, 5) v = Left(X, 1) If v "-" Then Dim sTemp As String sTemp = "" sStrIn = txtSSN.Text sStrIn = sStrIn & String$(9, "0") If sStrIn String$(9, "0") Then sStrIn = Left$(sStrIn, 9) sTemp = Left$(sStrIn, 3) & "-" & Mid$(sStrIn, 4, 2) & "-" & Right$(sStrIn, 4) End If txtSSN.Text = sTemp End If End Sub Please Help!!!!!!
0
SaswatPadhi's Avatar, Join Date: May 2009
~ Б0ЯИ Τ0 С0δЭ ~


Why don't you post your code within a code-block ?
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
Quote:
Originally Posted by SaswatPadhi View Post


Why don't you post your code within a code-block ?
Doing so also would not help because they are posted in one line.

Try to post code which is readable
0
jcamden's Avatar
Newbie Member
Well i tried to do it as readable as possible, but anyway i put it it appears as it is

So is there anyone who would know the correct syntax for the code that would only require the last 4 of the SSN
0
shabbir's Avatar, Join Date: Jul 2004
Go4Expert Founder
If have the VB editor copy it correctly and post it and try seeing a preview.

If it does not work try pasting it in notepad and then again copy and paste here.

New Line should be preserved no matter what.

Also if the error occurred once it would occur once again no matter how many times you create the thread.