Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2012
    Posts
    38

    Unanswered: VBA Code to Differentiate New Data from Old Data

    Windows 7, Microsoft Access 2007, VBA

    I have a routine I've put together where I send out a bunch of records to the email address that's in one of the fields in each record. Some records don't have emails yet (null field) so I made a form for a user to enter the email into that field.

    These records are orders, and when they come in, I'd like to immediately email the records that do have an email and then once the user enters the email addresses for the others, send them out too.

    As of now, I can't figure out how to only send out the records with newly recorded email addresses. Right now my script would send the records that had email addresses in the first place out twice (once initially, and then again once the user enters in the null emails and clicks send).

    What would be an approach to just having the records that haven't been sent yet, get sent?

  2. #2
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    One way would be a yes/no field in the table, for example "EmailSent". Set it to True when you send an email, and exclude those with True in your routine.
    Paul

  3. #3
    Join Date
    Jun 2012
    Posts
    38
    Thanks, I think that should suffice. If I can get it to work.

  4. #4
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    No problem; post back if you get stuck.
    Paul

  5. #5
    Join Date
    Jun 2012
    Posts
    38
    Thanks, problem solved.

    I used a SQL update statement to set the value of the yes/no field, for anyone following.

Posting Permissions

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