• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 245
  • Last Modified:

Adding more fields to send in the email

How do I add more fields from my table to the statement below?

DoCmd.SendObject , , , "John.Anderson@ladwp.com", , , "Mobile Service Request", "Please repair or service this unit: " & (Me![service_id]), False

I am working with a button that I am using to email the current record on a form to a specified user via my default email app (Outlook 2003 on an exchange server).  Here is all of the code from the button in question.

Private Sub Svc_Inv_Click()
On Error GoTo Err_Svc_Inv_Click

    DoCmd.SendObject , , , "John.Anderson@ladwp.com", , , "Mobile Service Request", "Please repair or service this unit: " & (Me![service_id]), False
         
Exit_Svc_Inv_Click:
    Exit Sub

Err_Svc_Inv_Click:
    MsgBox Err.Description
    Resume Exit_Svc_Inv_Click
   
End Sub

Thanks in advance for the help.  I have used access with the wizard stuff for sometime, however this is my first time needing to do something with visual basic code.
   
0
jande2
Asked:
jande2
  • 4
  • 3
1 Solution
 
flavoCommented:
What fields?  And where do you want them - subject / msg body??

Dave
0
 
jande2Author Commented:
I want to place all of the fields I want to send in the message body.
0
 
flavoCommented:
Something like:


    DoCmd.SendObject , , , "John.Anderson@ladwp.com", , , "Mobile Service Request", "Please repair or service this unit: " & Me![service_id] &_
 Me![SomeOtherField] & Me![SomeOtherFeildHereToo], False

If you post back the exact field names, and the order you want them in, including any other text (such as commas between the field text etc...) I can post back something you should be able to copy and paste right in

Dave
0
Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

 
jande2Author Commented:
The fields I have are [service_id] [user_name] [staff_id] [sn_no] [mach_name]

I would like to separate them with a label for each field such as:

"Service Order #" [service_id], "Name"[user_name],"Tech" [staff_id], "SN" [sn_no], "Mach Name" [mach_name]

Is this possible?

Thanks
0
 
flavoCommented:
Sure:


    DoCmd.SendObject , , , "John.Anderson@ladwp.com", , , "Mobile Service Request", "Please repair or service this unit: " & _
            "Service Order # " &  Me.[service_id] & ", Name " & Me.[user_name] & _
             " , Tech " & Me.[staff_id] & " , SN " &  Me.[sn_no] & ", Mach Name " & Me.[mach_name], False

Dave
0
 
jande2Author Commented:
Thanks for all of your help.  This does exactly what i need it to do.
0
 
flavoCommented:
Glad to help mate

Dave :^)
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now