Results 1 to 10 of 10

Thread: [RESOLVED] After email sent update recordset feild

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2005
    Location
    Long Island, NY.
    Posts
    353

    Resolved [RESOLVED] After email sent update recordset feild

    How do I update the strEmailsent feild after an email is sent?

    VB Code:
    1. DoCmd.SendObject , , acFormatTXT, stEmailAddress3 & ";" & stEmailAddress, stEmailAddress4 & ";" & stEmailAddress2, , stSubject, stText, -1
    2.     rs!strEmailsent = True ' --this is a YES/NO checkbox feild
    3.     rs.MoveNext

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: After email sent update recordset feild

    Use -1 unstead of True.

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2005
    Location
    Long Island, NY.
    Posts
    353

    Re: After email sent update recordset feild

    Not working. Error Saying Update or Cancel update without Addnew or Edit

  4. #4
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    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?

  5. #5
    old fart Frans C's Avatar
    Join Date
    Oct 1999
    Location
    the Netherlands
    Posts
    2,926

    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.
    Frans

  6. #6
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: After email sent update recordset feild

    Moved to Office Development forum.
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  7. #7

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2005
    Location
    Long Island, NY.
    Posts
    353

    Re: After email sent update recordset feild

    Hmm I am lost...
    VB Code:
    1. DoCmd.SendObject , , acFormatTXT, stEmailAddress3 & ";" & stEmailAddress, stEmailAddress4 & ";" & stEmailAddress2, , stSubject, stText, -1
    2.     rs.Edit strEmailsent = -1
    3.     rs.Update strEmailsent
    4.     rs.MoveNext

  8. #8
    Frenzied Member
    Join Date
    Feb 2003
    Location
    Argentina
    Posts
    1,950

    Re: After email sent update recordset feild

    VB Code:
    1. DoCmd.SendObject , , acFormatTXT, stEmailAddress3 & ";" & stEmailAddress, stEmailAddress4 & ";" & stEmailAddress2, , stSubject, stText, -1
    2.     rs.Edit
    3.     'this assumes you have a field in the rs called strEmailsent
    4.     'If this isn't the actual name of the field, use the correct one
    5.     rs!strEmailsent = -1
    6.     rs.Update
    7.     'you don't need .Movenext unless this is in a loop you didn't include in the post
    8.     rs.MoveNext
    Hack, why use -1 instead of True?
    Tengo mas preguntas que contestas

  9. #9
    Ex-Super Mod RobDog888's Avatar
    Join Date
    Apr 2001
    Location
    LA, Calif. Raiders #1 AKA:Gangsta Yoda™
    Posts
    60,709

    Re: After email sent update recordset feild

    Are you using a DAO recordset or a ADO one?
    VB/Office Guru™ (AKA: Gangsta Yoda®)
    I dont answer coding questions via PM. Please post a thread in the appropriate forum.

    Microsoft MVP 2006-2011
    Office Development FAQ (C#, VB.NET, VB 6, VBA)
    Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
    If a post has helped you then Please Rate it!
    Reps & Rating PostsVS.NET on Vista Multiple .NET Framework Versions Office Primary Interop AssembliesVB/Office Guru™ Word SpellChecker™.NETVB/Office Guru™ Word SpellChecker™ VB6VB.NET Attributes Ex.Outlook Global Address ListAPI Viewer utility.NET API Viewer Utility
    System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6

  10. #10

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2005
    Location
    Long Island, NY.
    Posts
    353

    Re: After email sent update recordset feild

    Quote Originally Posted by salvelinus
    VB Code:
    1. DoCmd.SendObject , , acFormatTXT, stEmailAddress3 & ";" & stEmailAddress, stEmailAddress4 & ";" & stEmailAddress2, , stSubject, stText, -1
    2.     rs.Edit
    3.     'this assumes you have a field in the rs called strEmailsent
    4.     'If this isn't the actual name of the field, use the correct one
    5.     rs!strEmailsent = -1
    6.     rs.Update
    7.     'you don't need .Movenext unless this is in a loop you didn't include in the post
    8.     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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width