G
Guest
I have to run this many thousands of times in a conversion program, is this the most efficient way to do it? I was unsure if I need to close the recordset before I do the INSERT, or if I can just leave it open. Thanks.
Dim strSQL As String
KW = Replace(KW, "'", "''")
strSQL = "SELECT ID FROM tblKeywords WHERE UCase(KWName) = '" & UCase(KW) & "'"
Call rsKW.Open(strSQL, CurrentProject.Connection, adOpenForwardOnly, adLockReadOnly)
If rsKW.EOF Then
rsKW.Close
strSQL = "INSERT INTO tblKeywords (KWName) VALUES ('" & KW & "')"
CurrentProject.Connection.Execute (strSQL)
Else
rsKW.Close
End If
Dim strSQL As String
KW = Replace(KW, "'", "''")
strSQL = "SELECT ID FROM tblKeywords WHERE UCase(KWName) = '" & UCase(KW) & "'"
Call rsKW.Open(strSQL, CurrentProject.Connection, adOpenForwardOnly, adLockReadOnly)
If rsKW.EOF Then
rsKW.Close
strSQL = "INSERT INTO tblKeywords (KWName) VALUES ('" & KW & "')"
CurrentProject.Connection.Execute (strSQL)
Else
rsKW.Close
End If