Sorry if this question has already been answered but I have been unable to find an answer that pertains to my code.
Here it is...I created a select query built on the fly from a field on a table. I need the query to supply information that will be used in an email. I then however want to update another table with a true value. It will mean that I have sent the email to that person. Here is what I have.
Second sql statement is
I receive the error here Set rs2 = DB.OpenRecordset(strsqll)
Here it is...I created a select query built on the fly from a field on a table. I need the query to supply information that will be used in an email. I then however want to update another table with a true value. It will mean that I have sent the email to that person. Here is what I have.
Code:
strsql = "SELECT tblEmailMaster.[First Name], tblEmailMaster.[Last Name],
tblEmailMaster.UserType, tblEmailMaster.[Company ID],
tblEmailMaster.[Email Address], tblFromMasterOfACsToBeEmailed.UserType,
tblFromMasterOfACsToBeEmailed.[Company ID], tblEmailMaster.ACEmailCheck " &
_
"FROM tblEmailMaster INNER JOIN tblFromMasterOfACsToBeEmailed ON
tblEmailMaster.[Company ID] = tblFromMasterOfACsToBeEmailed.[Company ID] "
& _
"WHERE (((tblEmailMaster.UserType) is not null) AND
((tblFromMasterOfACsToBeEmailed.[Email Address])='" & varAcEmail & "') AND
((tblFromMasterOfACsToBeEmailed.[Company ID])='" & varCompanyId & "')) " &
_
"ORDER BY tblEmailMaster.[Last Name];"
Second sql statement is
Code:
strsqll = "UPDATE tblEmailMaster SET tblEmailMaster.Shutdown = True" & _
"WHERE (((tblEmailMaster.[First Name])='" & varOpFirstName & "') AND
((tblEmailMaster.[Last Name])='" & varOpLastName & "') AND
((tblEmailMaster.[Company ID])='" & varCompanyId & "'));"
I receive the error here Set rs2 = DB.OpenRecordset(strsqll)