Question : How to modify vb script to see if the social security number already exists and if so ask weather to add or not.

I need to modify this script to determine if the text file I want to import contains a ss number that already exists in the main table and if so to ask weather to add the record or not.

code attached

After this script reads the text file into the contacts table the is a bit of script that runs an append query to append the record from the contact table to the main table.

Thank you
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
Dim s As String, blOK As Boolean
Dim rs As DAO.Recordset
Set rs = CurrentDb.OpenRecordset("Contacts")
Open "C:\text.txt" For Input As #1
rs.AddNew
Do Until EOF(1)
    Line Input #1, s
    If blOK = False Then
    Do
        Line Input #1, s
        blOK = InStr(s, "FirstName") > 0
    Loop Until InStr(s, "FirstName") > 0
    
    End If
    If blOK Then
    rs(Trim(Split(s, "=")(0))) = Trim(Split(s, "=")(1))
    End If
Loop
rs.Update
Close #1
rs.Close

Answer : How to modify vb script to see if the social security number already exists and if so ask weather to add or not.

Yes you can.  The Raid array will maintain the configuration in a ROM.
Random Solutions  
 
programming4us programming4us