Results 1 to 5 of 5
  1. #1
    4 Star Lounger
    Join Date
    Jun 2001
    Posts
    531
    Thanks
    0
    Thanked 0 Times in 0 Posts

    List box entries written to email (97)

    How might I click on several list box entries & have them be written to the body of an email?

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: List box entries written to email (97)

    If you want the text to be assembled as the uses clicks each list box:

    1. Declare a module-level string variable; it will be used as the message text (body) of the e-mail.
    2. Add portions to the string in the OnClick event of each of the list boxes, something like
    strMessage = strMessage & vbCrLf & lstListbox
    3. Create the e-mail in the OnClick of a command button:
    DoCmd.SendObject ObjectType:=acSendNoObject, MessageText:=strMessage
    (You probably want to set more parameters; look up SendObject in the online help)

  3. #3
    4 Star Lounger
    Join Date
    Jun 2001
    Posts
    531
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: List box entries written to email (97)

    yes but only one list box is involved & it is multi select so I

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: List box entries written to email (97)

    If you have a multi-select list box, adding and removing strings on the fly will be a nightmare. I would use a command button instead and use code in the OnClick event that assembles the string variable based on the selected items in the list box:

    Dim i As Long
    Dim strReturn As String
    Const clngColumnToReturn = 0
    For i = 0 To lstMultiSelect.ListCount - 1
    If lstMultiSelect.Selected(i) Then
    strReturn = strReturn & lstExtended.Column(clngColumnToReturn, i) & vbCrLf
    End If
    Next i

    clngColumnToReturn is the zero-based index of the column that contains the text to be used. In the code above, it i 0 (the first column). Change if necessary.

  5. #5
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: List box entries written to email (97)

    You wouldn't remove the value from the string, you would rebuild the entire string without that value in it.
    Charlotte

Posting Permissions

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