Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!
  1.   Become a Supporter    ::   Make a Contribution   
    Target (Recurring Monthly): $200 :: Achieved: $98

Simple email from Access 2003 form

Discussion in 'Information Technology' started by Fred, Jul 28, 2006.

  1. Fred

    Fred
    Expand Collapse
    Guest

    I have been searching out VB code to accomplish a simple task and keep
    running into snags. I have a form including these fields:

    - CourseName
    - CourseNumber
    - ProjectCoordinator
    - email

    The "ProjectCoordinator" control on the Courses form is a combo box
    drawing from a related table called (T) Names. The "email" control is
    automatically populated when the name is chosen.

    I want to create a button that, when clicked, creates an email in
    Outlook 2003 to the Project Coordinator and tells them that their
    learning module has been uploaded and is ready for the staff.

    Here is the code I have so far - it is edited from the closest I could
    find in another message here.

    Private Sub Command231_Click()
    Dim strTo As String
    Dim strBody As String
    Dim strSubject As String

    strTo = DLookup(email, "(T) Names", "Name = " & Me.ProjectCoordinator)
    strBody = "Your CBL with the title and course number shown above has
    been published in the Learning Management System and is available for
    staff."
    strSubject = "Learing Module information"
    DoCmd.SendObject , , acFormatTXT, strTo, , , strSubect, strBody, True

    End Sub

    I am getting an error in the strTo line = Runtime error 3705. Syntax
    error (missing operator) in query expression 'name@email.com'

    Is this ensough info to tell where I am messing up?

    Thanks,
    Fred
     
  2. Loading...

    Similar Threads Forum Date
    Grammer / Vyakarn Learn Simple & Easiest Gurbani Vyakaran/grammer From Prof. Maninderpal Singh Language, Arts & Culture Mar 9, 2015
    General Babaji Ranjit Singh Dhandrian Wale, Simple living high Thinking Hard Talk Sep 27, 2013
    Sikh Weddings Simple? No, they Are Indulged In Brahmanwad Questions and Answers Sep 15, 2012
    The One-Minute Mystic: Simple Things You Can Do to Stay Connected Spiritual Articles May 23, 2011
    Being a Simple Sikh (blog of a Prithihardkaur Sikh) Spiritual Articles Sep 13, 2010

  3. Pieter Wijnen

    Pieter Wijnen
    Expand Collapse
    Guest

    Quotes, Quotes

    try
    strTo = DLookup("email", "(T) Names", "Name = '" & Me.ProjectCoordinator &
    "'")

    Pieter

    PS that is a nasty name for a Table/Query
    don't you get tired by hitting [] <g>

    "Fred" <langerfred@gmail.com> wrote in message
    news:1153944730.937836.315950@h48g2000cwc.googlegroups.com...
    >I have been searching out VB code to accomplish a simple task and keep
    > running into snags. I have a form including these fields:
    >
    > - CourseName
    > - CourseNumber
    > - ProjectCoordinator
    > - email
    >
    > The "ProjectCoordinator" control on the Courses form is a combo box
    > drawing from a related table called (T) Names. The "email" control is
    > automatically populated when the name is chosen.
    >
    > I want to create a button that, when clicked, creates an email in
    > Outlook 2003 to the Project Coordinator and tells them that their
    > learning module has been uploaded and is ready for the staff.
    >
    > Here is the code I have so far - it is edited from the closest I could
    > find in another message here.
    >
    > Private Sub Command231_Click()
    > Dim strTo As String
    > Dim strBody As String
    > Dim strSubject As String
    >
    > strTo = DLookup(email, "(T) Names", "Name = " & Me.ProjectCoordinator)
    > strBody = "Your CBL with the title and course number shown above has
    > been published in the Learning Management System and is available for
    > staff."
    > strSubject = "Learing Module information"
    > DoCmd.SendObject , , acFormatTXT, strTo, , , strSubect, strBody, True
    >
    > End Sub
    >
    > I am getting an error in the strTo line = Runtime error 3705. Syntax
    > error (missing operator) in query expression 'name@email.com'
    >
    > Is this ensough info to tell where I am messing up?
    >
    > Thanks,
    > Fred
    >




    --
    ----------------------------------------
    I am using the free version of SPAMfighter for private users.
    It has removed 4367 spam emails to date.
    Paying users do not have this message in their emails.
    Get the free SPAMfighter here: http://www.spamfighter.com/len
     
  4. Fred

    Fred
    Expand Collapse
    Guest

    Pieter Wijnen wrote:
    > Quotes, Quotes
    >
    > try
    > strTo = DLookup("email", "(T) Names", "Name = '" & Me.ProjectCoordinator &
    > "'")
    >
    > Pieter
    >
    > PS that is a nasty name for a Table/Query
    > don't you get tired by hitting [] <g>
    >


    Thank you, Pieter - yes, it worked.

    I never said I was smart <g> so nasty (T) Table Names, (F) Form Names,
    (M) Macro Names, (Q) Queries, etc. have resulted - need to switch to
    frmForm, tblTable, rptReport, etc.
     
Since you're here... we have a small favor to ask...

More people are visiting & reading SPN than ever but far fewer are paying to sustain it. Advertising revenues across the online media have fallen fast. So you can see why we need to ask for your help. Donating to SPN's is vote for free speech, for diversity of opinions, for the right of the people to stand up to religious bigotry. Without any affiliation to any organization, this constant struggle takes a lot of hard work to sustain as we entirely depend on the contributions of our esteemed writers/readers. We do it because we believe our perspective matters – because it might well be your perspective, too... Fund our efforts and together we can keep the world informed about the real Sikh Sikhi Sikhism. If everyone who writes or reads our content, who likes it, helps us to pay for it, our future would be much more secure. Every Contribution Matters, Contribute Generously!

    Become a Supporter      ::     Make a Contribution     



Share This Page