More automation in Access

F

Freehal04

I have an automated emailer code set up so Access tells Outlook to send out
an email. I was wondering if I can link this automated email to a specific
field in my table so when the 'due date' in my field arrives, Access knows
it's time to tell Outlook to email?
 
E

Ed Robichaud

Well, yes. You could use the events of a form (On Open, or On Current) to
check the value of your date control, then run your send email code.

If Me!myDueDate < Date() Then
'run my code
Else
End if


-Ed
 
F

Freehal04

Thanks, I'll try that out.

Ed Robichaud said:
Well, yes. You could use the events of a form (On Open, or On Current) to
check the value of your date control, then run your send email code.

If Me!myDueDate < Date() Then
'run my code
Else
End if


-Ed
 
F

Freehal04

I tried that expression you suggested and nothing happened. Perhaps I
entered it wrong, how do I tell the event On Open to read my code in VBA?
 
E

Ed Robichaud

Not sure what your "send email" code is, but you should be able to just
insert it where indicated. Mine is:

'=================================
On Error Resume Next
DoCmd.SendObject , , , Me!, , , "Subject text"

If Err.Number = 2501 Then
MsgBox " Email message cancelled ", vbExclamation
End If

'==================================

where [email] is the text box control on the form containing the email
address.

-Ed
 
Top