I Am fairly new at using vba to edit a table in access. I am wanting to check to see if a table has a first and last name already in it and if it does not then I want to add them too the table.
This is what I have so far...
Thanks in advance for the help!
This is what I have so far...
Code:
SQLName = "INSERT INTO [" & OtherTable & "] " & _
"SELECT [LastName] = " & Chr$(34) & LastName & Chr$(34) & _
" AND [FirstName] = " & Chr$(34) & FirstName & Chr$(34) & _
" WHERE NOT EXISTS (SELECT * " & _
"WHERE code = " & Chr$(34) & LastName & Chr$(34) & " AND " & Chr$(34) & FirstName & Chr$(34)
SQLName = "INSERT INTO [" & TableWithNames & "] " & _
"SELECT [" & LastName & "], AND [" & FirstName & "] " & _
"WHERE NOT EXISTS (SELECT * " & _
"WHERE code = " & LastName & ", AND " & FirstName
Comment