Populate Email Subject Line from Form Fields

eburgtech

Jack of All Trades
Local time
Yesterday, 23:56
Joined
Apr 22, 2010
Messages
27
Greetings,

I have a form that has all of our file information. There are various parts to our files and each piece is ordered from a client by our analysts. I want to create an email button that automatically puts the Order Number, Client Name and Client Number in the subject line of the email. I'm 90% sure there is a way to do this, but I haven't found anything or been able to figure it out. I do have working email code, so I'm thinking it's just a matter of some magic words to make my code populate the subject line. Any help would be awesome. I am running MS Access 2003. Thanks!
 
I am running Outlook. Thanks Bob, but that wasn't very useful. I know how to make it so that the same thing appears on every email (i.e. "This shows up on every email sent." - type of thing). What I am looking for is code that will create a Subject Line string pulling from 3 fields on the currently viewed record. In other words, if I am on Record 0123 for ClientOne, Client #321, I want the Subject Line to populate as "0123 ClientOne Client #321". Does that make sense?
 
Sorry, based on previous interactions I had thought you would be able to figure it out with a little help. So, you would need a recordset to pull the applicable information and then iterate through it (and either use that code to set the subject and do the email or else use SendObject.

Code:
Dim rst As DAO.Recordset
Dim strSQL As String
 
strSQL = "SELECT * FROM WhateverTable"
 
Set rst = Currentdb.OpenRecordset(strSQL)
 
Do Until rst.EOF
    WhateverYourEmailCodeIs.Subject = Format(rst!FieldNameHere, "0000") & rst!TheOtherFieldNameHere
    WhateverYourEmailCodeIs.Send
    rst.MoveNext
Loop
 
rst.Close
 
Set rst = Nothing

So, something like that (it is very wide open as I don't know what email code you have but hopefully you can figure out where to put this and how to pull the applicable fields and reference them in the recordset based on the sample code I just put above.
 

Users who are viewing this thread

Back
Top Bottom