Results 1 to 10 of 10
  1. #1
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383

    Prompt for email address on field

    I have a hard coded command button that send a email when they click on it. I need a way for the user to be prompted to input the address or else pull it from the Company's information, which would be better I think.
    Field name is E Mail and command button is named Command209. Here is the code behind the command button.


    The Company's information is stored in table Company and the field name is Company.Hmmm, how could I make it use the Company name instead of being hard coded? What do you think, prompt or use Company ?


    DoCmd.SendObject acSendNoObject, "FormTyp", acFormatHTML, [E Mail], , , , "From Anonymous Person", True, ""

  2. #2
    alansidman's Avatar
    alansidman is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,529
    Perhaps adding this to your code. Then take the result and put it into your SendObject line of code.

    http://office.microsoft.com/en-us/ac...001228856.aspx

  3. #3
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    How about if I add this code to the syntax I have some kind of way? That looks up the Company name and I could just use it instead by default. I don't know how to edit my code already and make it work though! I also added a field to my form for the company's email address and it is CompEmail it shows the company's email address.Anyway to use this and add to the syntax?

    DLookup("[Company]", "Company")
    Last edited by burrina; 01-20-2013 at 01:57 PM. Reason: I added somethinh else.

  4. #4
    alansidman's Avatar
    alansidman is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,529
    You have completely lost me on your last post. I have no idea what you are trying to say or do. Please try to explain that again.

    I believe that since you are using VBA in your DoCmd statement that if you added an input box and the result was just added to the DoCmd line where you have the [Email] would be the most expeditious answer unless there is something in what you have that you have not made us aware of. You would do this by creating a variable that took the value of the input box, then use the variable in your line of code.

    Alan

  5. #5
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    I just want to add the companys email address to the outgoing email being sent from the Customers form is all. I added a field to the customers form and set it to do a lookup and it now shows the companys email address. I dont know how to edit/make the syntax I have add the company email address to it is all!
    DoCmd.SendObject acSendNoObject, "FormTyp", acFormatHTML, [E Mail], , , , "From Anonymous Person", True, ""

    I need to get companys email address into the "From Anonymous Person" is what I am after. It uses whoever is in the field as to send to, just I dont have a send from!

  6. #6
    alansidman's Avatar
    alansidman is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Apr 2010
    Location
    Steamboat Springs
    Posts
    2,529
    Is the company email address in a control on your form now? If so, what is the name of the control? If not on the form, how will Access know what to put in there. If it is on the form, then something like the following

    Code:
    dim strCompAdd As String
    
    strComAdd = me.yourControlHoldingTheEmail.Value
    
    DoCmd.SendObject acSendNoObject, "FormTyp", acFormatHTML, [E Mail], , , , strComAdd, True, ""
    


    I hope I am understanding your issue, but this is how I interpreted your explanation.

  7. #7
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383

    Error using email code

    Yes, I think you do, however here is what I got: ? Code looked good to me? Error is Compile Error Variable Not Defined
    Attached Thumbnails Attached Thumbnails emialerror.jpg  
    Last edited by burrina; 01-20-2013 at 04:12 PM. Reason: specific error.

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Check your spelling.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  9. #9
    burrina's Avatar
    burrina is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    Good Catch Paul, Thanks... Good to Go!

  10. #10
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    No problemo!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 13
    Last Post: 11-07-2012, 03:14 PM
  2. Validating Email Address in VBA
    By Phil1 in forum Programming
    Replies: 4
    Last Post: 04-19-2012, 09:54 AM
  3. Adding a email address on form
    By akhlaq768 in forum Forms
    Replies: 3
    Last Post: 02-07-2012, 09:11 AM
  4. SendObject and No Email Address
    By Tomfernandez1 in forum Forms
    Replies: 6
    Last Post: 10-06-2011, 05:15 PM
  5. Multiple Email Address
    By Tomfernandez1 in forum Forms
    Replies: 15
    Last Post: 09-15-2011, 01:52 PM

Tags for this Thread

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