Page 1 of 2 12 LastLast
Results 1 to 15 of 17
  1. #1
    forrestapi is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jul 2010
    Posts
    39

    To feild in send object from Form


    I have a button on a form that when clicked regenerates the current opened record into a pdf and creates an email. What i am wondering is if there is any way to capture a certain field (the email address field obviously) and have that inserted in the the To field of the send object. I'm not sure if im explaining that properly, but basically when it generates the send object i want it to pull the email address from a certain text box located on a form, is that possible?

  2. #2
    TheShabz is offline Court Jester
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    1,368
    what are you using to send the Email?

  3. #3
    forrestapi is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jul 2010
    Posts
    39
    lets see if i can explain this properly. (for clairity sake lets say the form i am working from is called customers).

    on click on the button inside customers form it runs a macro that does the following:

    a prompt box appears that upon entering a criteria opens another form called customers email (its just a duplicate of the current form except its allows you to select a specific record instead of all). for clarity we will call this one customers email.

    it then gernerates the send object from customers email in pdf form.

    Microsoft Outlook 2007 opens (i have the send object set to modify yes), at which point i will now manually enter the email address.

  4. #4
    TheShabz is offline Court Jester
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    1,368
    i assume youre using SendObject as outlined here
    http://www.blueclaw-db.com/docmd_sendobject_example.htm

    If so, all you need to do is create a textbox on the form that holds the customer's email address from the process you mentioned. then in the "To" section, you pass the name of that textbox on the form. Me.txtBoxName

    I hope I'm following you with what you're looking for.

  5. #5
    forrestapi is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jul 2010
    Posts
    39
    Currently the onclick is a embeded macro. I am a noivce at best on VB language. So with that said im not sure exactly what langauage to use to do all the commands the current macro is performing. Is there any way in side the macro on the send object to populate the text box current value?

  6. #6
    TheShabz is offline Court Jester
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    1,368
    it wont work with just macro controls. you'll need to do it in VBA. no better time than the present to start learning!

  7. #7
    forrestapi is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jul 2010
    Posts
    39
    Just rushing through this i was able to come up with something i think may be close. Im sure its just the synax that is messing this up. here is the code i used to try and send the form as a pdf

    DoCmd.Sendobject (acSendForm,"Find My Assigned Problems Email",.pdf,Me.Emal,,,"Customer Problem", "Here is your API Probglem Log acknowledgment. If you feel this problem has not been fixed correctly, please give us a call and referance the Record ID number listed at the top of the paper. Thanks!")

    For referance, the form is called Find My Assigned Problems email, i want it in pdf form, the field i referced for the to address is name Email, Customer Problem is the subject, the long part is just a filler i put in now until it can be fine tuned.

    WIth that i get a compile error. says its expected: =

    am i on the right track?

  8. #8
    TheShabz is offline Court Jester
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    1,368
    nix using sendObject. save the form as a pdf and the try this out. hasn't failed me yet. you should be able to figure out what to change.

    private sub sendOutlookEmail()

    '**create variables for Outlook
    Dim objOutlook As Outlook.Application
    Dim objEmail As Outlook.MailItem

    '***creates an instance of Outlook
    Set objOutlook = CreateObject("Outlook.application")
    Set objEmail = objOutlook.CreateItem(olMailItem)

    '***creates and sends email
    With objEmail
    .To = me.txtEmailAddress
    .subject = "Whatever you want" or form object
    .body = "whatever you want" or form object
    .attachments.add "path to file"
    .send 'sends the email in Outlook. Change to DISPLAY if you want to be able to
    'modify or see what you have created before sending the email
    End With

    '**closes outlook
    Set objEmail = Nothing

    End sub

  9. #9
    forrestapi is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jul 2010
    Posts
    39
    Quote Originally Posted by TheShabz View Post
    nix using sendObject. save the form as a pdf and the try this out. hasn't failed me yet. you should be able to figure out what to change.

    private sub sendOutlookEmail()

    '**create variables for Outlook
    Dim objOutlook As Outlook.Application
    Dim objEmail As Outlook.MailItem

    '***creates an instance of Outlook
    Set objOutlook = CreateObject("Outlook.application")
    Set objEmail = objOutlook.CreateItem(olMailItem)

    '***creates and sends email
    With objEmail
    .To = me.txtEmailAddress
    .subject = "Whatever you want" or form object
    .body = "whatever you want" or form object
    .attachments.add "path to file"
    .send 'sends the email in Outlook. Change to DISPLAY if you want to be able to
    'modify or see what you have created before sending the email
    End With

    '**closes outlook
    Set objEmail = Nothing

    End sub
    .




    ok i took this and tried to aplly it to another situation, as the orginal on is on the back burner. What im trying to do here is when a button is clicked it does a few things. It updates a couple tables. What iw ould also like for it to do is send an email to a person (im pulling the email addy from a box located on the form. When i try it i get a compile error. Any idea on whats wrong with my code? the only aread highlighted in yellow is the first line (Private Sub Command2_Click() )

    Private Sub Command2_Click()
    DoCmd.OpenQuery "Assign A Problem", acViewNormal, acEdit
    DoCmd.OpenQuery "Add Name to Employee List"
    DoCmd.OpenQuery "Add name to Employee with Problems"
    Private Sub sendOutlookEmail()

    '**create variables for Outlook
    Dim objOutlook As Outlook.Application
    Dim objEmail As Outlook.MailItem
    '***creates an instance of Outlook
    Set objOutlook = CreateObject("Outlook.application")
    Set objEmail = objOutlook.CreateItem(olMailItem)
    '***creates and sends email
    With objEmail
    .To = Me.txt23
    .subject = "New Problem"
    .body = "Please check the help desk data base for your newly listed Problems"
    .DISPLAY 'sends the email in Outlook. Change to DISPLAY if you want to be able to
    'modify or see what you have created before sending the email
    End With
    '**closes outlook
    Set objEmail = Nothing


    DoCmd.Close acForm, "Assign Problem Msg Box"

    End Sub







    I know im way in over my head here and could be totally off. any help would be great

  10. #10
    TheShabz is offline Court Jester
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    1,368
    remove:
    Private Sub sendOutlookEmail()

    you should be good after that.

  11. #11
    forrestapi is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jul 2010
    Posts
    39
    that come back with another comple error on line

    Dim objOutlook As Outlook.Application

    says user defined-type not defined

  12. #12
    TheShabz is offline Court Jester
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    1,368
    in the VBA window, go to Tools>References. Make sure the Outlook Object is checked.

  13. #13
    forrestapi is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jul 2010
    Posts
    39
    The referances field is greyed out, and not selectable

  14. #14
    TheShabz is offline Court Jester
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    1,368
    wow, odd. i dont know why that would be the case.

  15. #15
    forrestapi is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Jul 2010
    Posts
    39
    i got it to "un"grey. there is a lon list, do you know the specific name of the one your tlaking about?

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Saving unbound feild values
    By John Saul in forum Access
    Replies: 1
    Last Post: 06-19-2013, 06:22 AM
  2. send object report
    By ldappa in forum Access
    Replies: 1
    Last Post: 07-19-2010, 10:10 AM
  3. Send Object to addresses in table
    By cm-net in forum Access
    Replies: 1
    Last Post: 04-26-2010, 02:36 PM
  4. Send Primary Key from a Form To A Report
    By nkuebelbeck in forum Forms
    Replies: 1
    Last Post: 03-18-2010, 12:24 PM
  5. Net Send from a button on an Access form
    By Deb4995 in forum Forms
    Replies: 0
    Last Post: 10-19-2006, 10:19 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums