Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Flag in VB

Status
Not open for further replies.

SpyderMan1234

IS-IT--Management
Feb 26, 2004
35
US
I'm fairly new to VBA, but I've managed to create a DB that sends out emails to addresses obtained through a form. After an email is sent to a certain individual I need to flag the record so that you cannot send anymore emails. I understand the logic on how to do this, but I cannot figure out how to reference the field "EmailFlag" in Table1 in my code in order to increment the flag from a 0 to a 1. Is it necessary to connect to the database?

Thanks in advance
 
SpyderMan1234

You can add a field to your table to track this, but rather than using a True/False Yes/No boolean data type, consider using a Date data type. Have the system insert the current date when the eMail was sent.

You can find out what addressee's have not been emailed by looking for a Null date, or you can depict the specific date an email was sent.

Assumptions:
- You are using code to send the eMail, so you have an idead about coding
- You are on the form with the record for the eMail being sent
- The name of field is SentDate

To do this, after the eMail has been sent, add the code...
[tt]
Me.SendDate = Now()
[/tt]

Now() inserts the current date + time.

Richard
 
You could alternatively have a field called emailflag as a yes/no.

and on the on click function of the send email, have it set the yes/no box = -1.

i.e.

forms![formsname]![yes/nobox] = -1

i hope this helps

Chris
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top