Defining object in sub

lotarugg

Registered User.
Local time
Today, 12:39
Joined
Mar 15, 2011
Messages
34
I have this below in which I'm missing the right syntax. I get 'external name not defined' error where I have tried to define Email_Date on the 2nd line.

Thanks

Sub EmailSent()
If [Tables!Table_Date.Table.Email_Date] <> Date Then
[Tables!Table_Date.Table.Email_Date] = Date
Result = SendEMail()

Else

Result = "Today's emails have already been sent!"

End If

End Sub
 
Code:
Public Sub EmailSent()
Dim db As Database, rst As Recordset
Set rst = db.OpenRecordset("Table_Date")

With rst
If ![Email_Date] <> Date Then
    .Edit
    ![Email_Date] = Date
    .update
    Result = SendMail()
Else
    Result = "Today's emails have already been sent!"
End If
End With
rst.Close

Set rst = Nothing
Set db = Nothing


End Sub
 

Users who are viewing this thread

Back
Top Bottom