Here is another question:
I have a form called "frmDesignation" in which I have the following fields:
analyst Name (is a cbobox)
Document
Block
e-mail (analyst email)
In this form each line record is composed for a description of a Block and a document to be assigned to an analyst by the area supervisor.
The field analyst Name has a VBA code in the afterupdate event that when the supervisor choose the analyst from cbobox, It prompts the outlook warning to send a static standard message in an outlook email. It is working perfectly, no problems.
But I would like to know how could I include the fields "Document" and "Block" as part of a concatenated text body in the email depending on the analyst that is being picked in this form.
Code:
Private Sub analyst Name_AfterUpdate()
Dim sSubject As String
Dim stMail As String
Dim strBody As String
'message subject
sSubject = "A new task was assigned to you"
'sends email to name in Employee on the current form
stMail = DLookup("[e-mail]", "Employee", "[e-mail]= Form![frmDesignation].[e-mail]")
'email body
strBody = "The following document was assigned to your evaluation:" & Form![frmDesignation].[Block] & Form![frmDesignation].[Document]"
DoCmd.RunCommand acCmdSaveRecord
DoCmd.SendObject acSendNoObject, , , stMail, , , sSubject, strBody, False
End Sub
But I am having a sintax error and in fact, I think that I have to use in some way the dlookup function to lookup for the analyst Name in this form and then to return the assigned Block and document... I just dont know how to write it to work.
I think that is also a very basic question for you, but for me as a newbie trying to understand, is very difficult. I even understood sometimes the logical involved but I am not capable to write it down (yet, because I am studying VBA in one site that was informed to me)...
thank you again!