Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2002

    Unanswered: sendobject - getting "to" and "subject" info from a form

    I'd like to get the "to" information and some of the body of a message (some dates) from a form. As I recall there is a way to do this but I can't seem to find where I have done it in the past or what it was.

    I tried just entering [forms]![test form]!to and subject test [forms]![test form]![begin date] but I got an unknown address error. When I just type in an email address it sends fine but in the subject I get the whole string rather than test [date].

    I imagine it's just a matter of syntax.


  2. #2
    Join Date
    Oct 2003
    Try putting the form data into local variables first and debug.print them to see what they contain:

    dim stTo as string, stDate as string
    stTo = [forms]![test form]!to
    stDate = [forms]![test form]![begin date]
    debug.print stTo & " " & stDate

    Use the stTo and the stDate in the SendObject command instead if need be.

  3. #3
    Join Date
    Oct 2002

    send object

    It's coming back to me know - bear with me I really don't know much vb stuff.

    for some reason it is not liking the "to" field. I'm getting an error back indicating that it is a null value which. I've entered a real email address as well as just a three letter string of characters thinking that maybe the period or @ was causing a problem with the same result.

    I've been using sendobject rather than the debug.print as I don't know how to do that to see what it's picking up.

    Below is my code:

    Option Compare Database

    Function export()

    Dim stTo As String, ststartDate As String, stendDate As String

    stTo = [Forms]![test export form]![to]
    ststartDate = [Forms]![test export form]![begin]
    stendDate = [Forms]![test export form]![end]
    DoCmd.SendObject acSendQuery, "compliance export query", acFormatXLS, [stTo], , , test & " " & ststartDate & " " & "to" & " " & stendDate

    End Function


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts