B
bymarce
I'm trying to make a comma seperate list of the selected items in an unbound
multiselect list box to use as the subject of an email and rather than
returning "1983-0616" it's returning "8". The lstMLO rowsource is a text
field of format "####-####". How can I fix this? Thanks.
Marcie
Private Sub cmdEmailWork_Click()
Dim vItm As Variant 'Make the query to get the email addresses.
Dim stWhat As String 'Based on
'http://www.mvps.org/access/reports/rpt0005.htm
Dim stCriteria As String
Dim stSQL As String
Dim loqd As QueryDef
Dim lngLen As Long
Dim strMLO As String
Dim lngMLO As Long
Dim strOP As String
Dim strCP As String
Dim rptqd As QueryDef
Dim stSQLrpt As String
Dim stMySubj As String
Dim stCma As String
Dim ctl As Control
Set ctl = Me.lstMLO
stWhat = "": stCriteria = "Data.MLO =": stCma = ", "
If ctl.ItemsSelected.Count > 0 Then
For Each vItm In ctl.ItemsSelected
stWhat = strOP & stCriteria & ctl.ItemData(vItm) & strCP &
"OR "
stMySubj = ctl.ItemData(vItm) & stCma
Next vItm
stWhat = Len(stWhat) - 1
stMySubj = Len(stMySubj) - 2
Else: MsgBox "You have not selected any records."
GoTo ErrExit
End If
multiselect list box to use as the subject of an email and rather than
returning "1983-0616" it's returning "8". The lstMLO rowsource is a text
field of format "####-####". How can I fix this? Thanks.
Marcie
Private Sub cmdEmailWork_Click()
Dim vItm As Variant 'Make the query to get the email addresses.
Dim stWhat As String 'Based on
'http://www.mvps.org/access/reports/rpt0005.htm
Dim stCriteria As String
Dim stSQL As String
Dim loqd As QueryDef
Dim lngLen As Long
Dim strMLO As String
Dim lngMLO As Long
Dim strOP As String
Dim strCP As String
Dim rptqd As QueryDef
Dim stSQLrpt As String
Dim stMySubj As String
Dim stCma As String
Dim ctl As Control
Set ctl = Me.lstMLO
stWhat = "": stCriteria = "Data.MLO =": stCma = ", "
If ctl.ItemsSelected.Count > 0 Then
For Each vItm In ctl.ItemsSelected
stWhat = strOP & stCriteria & ctl.ItemData(vItm) & strCP &
"OR "
stMySubj = ctl.ItemData(vItm) & stCma
Next vItm
stWhat = Len(stWhat) - 1
stMySubj = Len(stMySubj) - 2
Else: MsgBox "You have not selected any records."
GoTo ErrExit
End If