Hi all, I have a button in a form that should send an email IF there's an email adress in the related table OR display a message box if not.
I find the email adress in an other table using DLookup but I always get an invalid null use error message, can someone help me with this please ?
Here is the code I have right now:
I find the email adress in an other table using DLookup but I always get an invalid null use error message, can someone help me with this please ?
Here is the code I have right now:
Code:
Dim emailAdress As String
Dim emailSubject As String
Dim emailContent As String
emailAdress = DLookup("Courriel", "Table_Participants", "ID_Participant = " & Forms!Formulaire_Inscriptions!Participant)
emailSubject = "Confirmation blabla"
emailContent = "Ceci est pour blabla"
If emailAdress.Value Is Null Then
MsgBox "Le participant n'a pas d'adresse de courriel dans nos dossiers"
Else
stDocName = "Empty_Report"
DoCmd.SendObject acSendNoObject, stDocName, acFormatHTML, emailAdress, , , emailSubject, emailContent, True
ZT_DateConfirmation.SetFocus
ZT_DateConfirmation.Text = Date
End If