1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Solved: VBA Code to Differentiate New Data from Old Data

Discussion in 'Business Applications' started by axkoam, Jul 3, 2012.

Thread Status:
Not open for further replies.
Advertisement
  1. axkoam

    axkoam Thread Starter

    Joined:
    Jun 4, 2012
    Messages:
    22
    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. Rollin_Again

    Rollin_Again

    Joined:
    Sep 4, 2003
    Messages:
    4,732
    Add a column to the table containing the order information and use a boolean value (True / False) to flag the record as having had an email sent already. You just change the logic in your script to send emails for only those records where the flag is set to False.

    Regards,
    Rollin
     
  3. axkoam

    axkoam Thread Starter

    Joined:
    Jun 4, 2012
    Messages:
    22
    Thanks, problem solved.
    I used a SQL update statement to set the value of the yes/no field, for anyone following.
     
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/1059565