Have an adp database connected to SQL Server. Trying to read one table to update another one. Getting error about "Object variable or With variable not set"
I'm used to dealing with mdb DAO connections and not ADO. I'm sure I'm just missing how to Open the Recordset.
Dim strSqlQuery As String
Dim rs As ADODB.Recordset
strSQLQuery = "Select F1 from donotcontact1"
rs.Open strSQLQuery, CurrentProject.BaseConnectionString, adOpenForwardOnly, adLockReadOnly
With rs
Do While Not rs.EOF And Not rs.BOF
delemail = rs.Fields("F1")
CurrentDb.Execute "Update Leads set EMailAddress = null where EMailAddress = '" & delemail & "'"
.MoveNext
Loop
.Close
End With
I'm used to dealing with mdb DAO connections and not ADO. I'm sure I'm just missing how to Open the Recordset.
Dim strSqlQuery As String
Dim rs As ADODB.Recordset
strSQLQuery = "Select F1 from donotcontact1"
rs.Open strSQLQuery, CurrentProject.BaseConnectionString, adOpenForwardOnly, adLockReadOnly
With rs
Do While Not rs.EOF And Not rs.BOF
delemail = rs.Fields("F1")
CurrentDb.Execute "Update Leads set EMailAddress = null where EMailAddress = '" & delemail & "'"
.MoveNext
Loop
.Close
End With