[RESOLVED] After email sent update recordset feild
How do I update the strEmailsent feild after an email is sent?
VB Code:
DoCmd.SendObject , , acFormatTXT, stEmailAddress3 & ";" & stEmailAddress, stEmailAddress4 & ";" & stEmailAddress2, , stSubject, stText, -1
rs!strEmailsent = True ' --this is a YES/NO checkbox feild
rs.MoveNext
Re: After email sent update recordset feild
Re: After email sent update recordset feild
Not working. Error Saying Update or Cancel update without Addnew or Edit
Re: After email sent update recordset feild
Quote:
Originally Posted by vonoventwin
Not working. Error Saying Update or Cancel update without Addnew or Edit
Then you need to do an AddNew or an Edit on the recordset.
Is this VB or VBA?
Re: After email sent update recordset feild
If it is a DAO recordset, you need to add rs.Edit before you change the value, and rs.Update afterwards.
If it is an ADO recordset you don't need the rs.Edit, but you still need the rs.Update.
Re: After email sent update recordset feild
Moved to Office Development forum. :)
Re: After email sent update recordset feild
Hmm I am lost...
VB Code:
DoCmd.SendObject , , acFormatTXT, stEmailAddress3 & ";" & stEmailAddress, stEmailAddress4 & ";" & stEmailAddress2, , stSubject, stText, -1
rs.Edit strEmailsent = -1
rs.Update strEmailsent
rs.MoveNext
Re: After email sent update recordset feild
VB Code:
DoCmd.SendObject , , acFormatTXT, stEmailAddress3 & ";" & stEmailAddress, stEmailAddress4 & ";" & stEmailAddress2, , stSubject, stText, -1
rs.Edit
'this assumes you have a field in the rs called strEmailsent
'If this isn't the actual name of the field, use the correct one
rs!strEmailsent = -1
rs.Update
'you don't need .Movenext unless this is in a loop you didn't include in the post
rs.MoveNext
Hack, why use -1 instead of True?
Re: After email sent update recordset feild
Are you using a DAO recordset or a ADO one?
Re: After email sent update recordset feild
Quote:
Originally Posted by salvelinus
VB Code:
DoCmd.SendObject , , acFormatTXT, stEmailAddress3 & ";" & stEmailAddress, stEmailAddress4 & ";" & stEmailAddress2, , stSubject, stText, -1
rs.Edit
'this assumes you have a field in the rs called strEmailsent
'If this isn't the actual name of the field, use the correct one
rs!strEmailsent = -1
rs.Update
'you don't need .Movenext unless this is in a loop you didn't include in the post
rs.MoveNext
Hack, why use -1 instead of True?
This worked! I know what I want to do, but syntax kills me since I don't know anything about programming. Yes I have it in a Loop statement.