Results 1 to 4 of 4
  1. #1
    moneypennie21 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    May 2017
    Posts
    41

    DoCmd.SendObject acSendNoObject - Syntax error


    Hi, I am trying to set up a button on a form that when clicked will send an email from outlook, can anyone tell me why I am getting a syntax error on this code?

    DoCmd.SendObject acSendNoObject,,,(emailaddress),,,(subject),(text)


    Thanks

  2. #2
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2010 64bit
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051
    Do you deliberately have () round the information?


    This works fine on my machine

    DoCmd.SendObject acSendNoObject, , , "realemailaddress", , , "Test", "Hi all", False

  3. #3
    moneypennie21 is offline Advanced Beginner
    Windows 10 Access 2016
    Join Date
    May 2017
    Posts
    41
    Hi Andy, that works brilliantly! Yes I tried it with or without brackets but not quote marks! am quite new to Access VBA and SQL so just learning every day and getting used to all the syntax and its idiosyncrasies. I assume the FALSE st the end is the edit properties? I have set this to true as I need the users to enter information into the email and it works.

    I love these forums they help so much!

    thanks for your help :

  4. #4
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2010 64bit
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051
    Happy to help

    Basically if you want to send something like the word subject, then you use "subject". If you have previously defined subject as a variable with something like:

    dim subject as string
    subject = "urgent - please ignore"

    then you should use subject (without the quotes)

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

Similar Threads

  1. Replies: 1
    Last Post: 07-30-2015, 12:56 PM
  2. Replies: 15
    Last Post: 06-29-2015, 11:12 AM
  3. Compile Error: Syntax Error in DoCmd.RunSQL Statement
    By Evilferret in forum Programming
    Replies: 1
    Last Post: 08-27-2012, 12:32 PM
  4. Syntax Error with DoCmd.RunSQL
    By dandoescode in forum Programming
    Replies: 2
    Last Post: 06-25-2012, 11:06 AM
  5. DoCmd.OpenForm Syntax Error
    By alsoto in forum Forms
    Replies: 3
    Last Post: 02-29-2012, 01:14 PM

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