1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Need Help With VB,

Discussion in 'Visual Basic ( VB )' started by jcamden, May 12, 2009.

  1. jcamden

    jcamden New Member

    Joined:
    May 12, 2009
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    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!!!!!!
     
  2. SaswatPadhi

    SaswatPadhi ~ Б0ЯИ Τ0 С0δЭ ~

    Joined:
    May 5, 2009
    Messages:
    1,343
    Likes Received:
    55
    Trophy Points:
    0
    Occupation:
    STUDENT !
    Location:
    Orissa, INDIA
    Home Page:
    :angry:

    Why don't you post your code within a code-block ?
     
  3. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,287
    Likes Received:
    364
    Trophy Points:
    83
    Doing so also would not help because they are posted in one line.

    Try to post code which is readable
     
  4. jcamden

    jcamden New Member

    Joined:
    May 12, 2009
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    0
    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
     
  5. shabbir

    shabbir Administrator Staff Member

    Joined:
    Jul 12, 2004
    Messages:
    15,287
    Likes Received:
    364
    Trophy Points:
    83
    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.
     

Share This Page