Unique Number in Email Subject Line

A

ADB_Seeker

I am using Send Object to send an email and want to put a unique number in
the subject line. I saw a post from 2006 that gave a suggestion to put the
following code in the subject line, but it isn't working for me. I changed
UniqueNumber to the control source that I want included (EO NUMBER). Please
help.

Suggested Code:

="Blabla " & [UniqueNumber] & " bla"

Following is the VB code in my SendObject. I didn't need more text after the
unique number so I put a space.

DoCmd.SendObject acSendNoObject, To:=Me.email, , ,"ER REQUEST APPROVED-EO
NUMBER IS & [EO Number] & "

Thanks in advance for your help.
 
J

John W. Vinson

I am using Send Object to send an email and want to put a unique number in
the subject line. I saw a post from 2006 that gave a suggestion to put the
following code in the subject line, but it isn't working for me. I changed
UniqueNumber to the control source that I want included (EO NUMBER). Please
help.

Suggested Code:

="Blabla " & [UniqueNumber] & " bla"

Following is the VB code in my SendObject. I didn't need more text after the
unique number so I put a space.

DoCmd.SendObject acSendNoObject, To:=Me.email, , ,"ER REQUEST APPROVED-EO
NUMBER IS & [EO Number] & "

Thanks in advance for your help.

You need to concatenate the *value* of [EO Number]; now you're just including
the name of the field as a string literal. Try

DoCmd.SendObject acSendNoObject, To:=Me.email, , ,"ER REQUEST APPROVED-EO
NUMBER IS " & [EO Number]

If this is on a Form you may need to use Me![EO Number].
 
A

ADB_Seeker

Thank you! That worked perfectly. And, yes this is in a form so I used the
Me![TEXT] format.
I had another problem with the code and figured it out. In case someone else
needs this information, I took out the To: and put in Me![sendemail] and that
solved the other issue. Following is the full code:

Private Sub sendemail_AfterUpdate()
DoCmd.SendObject acSendNoObject, , , Me![sendemail], , , "ER REQUEST
APPROVED-EO NUMBER IS " & Me![EO NUMBER]

Exit_sendemail_AfterUpdate:
Exit Sub

Err_sendemail_AfterUpdate:
MsgBox Err.Description
Resume Exit_sendemail_AfterUpdate

End Sub

John W. Vinson said:
I am using Send Object to send an email and want to put a unique number in
the subject line. I saw a post from 2006 that gave a suggestion to put the
following code in the subject line, but it isn't working for me. I changed
UniqueNumber to the control source that I want included (EO NUMBER). Please
help.

Suggested Code:

="Blabla " & [UniqueNumber] & " bla"

Following is the VB code in my SendObject. I didn't need more text after the
unique number so I put a space.

DoCmd.SendObject acSendNoObject, To:=Me.email, , ,"ER REQUEST APPROVED-EO
NUMBER IS & [EO Number] & "

Thanks in advance for your help.

You need to concatenate the *value* of [EO Number]; now you're just including
the name of the field as a string literal. Try

DoCmd.SendObject acSendNoObject, To:=Me.email, , ,"ER REQUEST APPROVED-EO
NUMBER IS " & [EO Number]

If this is on a Form you may need to use Me![EO Number].
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top