Eightball3
Programmer
First of all thanks to everyone here at Tek-Tips. This site is great!
I have a listbox that contains the names of people I would like to send an attached report via email to. The listbox is set to have multiple selections. I have a button at the botton of the screen that when pressed will initiate the emailings.
What I would like to have happen is that as each email is sent out, that selected person in the listbox unselects. The user would be able to see items unselecting as this process works. I have the emailing working except for the unselecting process...I just can't get that working. Below is my code. Can someone tell me where I'm going wrong at?
Dim ctrl As Control
Dim x As Integer
Dim y As Integer
If List0.ItemsSelected.Count > 0 Then
Set ctrl = [List0]
y = List0.ItemsSelected.Count
For x = y To 1 Step -1
If List0.ItemsSelected.Count = 0 Then
Else
Me![Activity] = ctrl.Column(1, List0.ItemsSelected(x - 1))
Me![POC] = ctrl.Column(0, List0.ItemsSelected(x - 1))
DoCmd.OpenForm "poc_form", acNormal, , , acFormEdit, acIcon
Forms![poc_form].RecordSource = "Email_Recall2"
If Forms![poc_form]![E_Mail_Recall] = "y" Then
Dim strREPORTNAME As String
Dim strTEMPFILENAME As String
strREPORTNAME = "Recall Notice"
strTEMPFILENAME = "C:\App\Recall.snp"
DoCmd.OutputTo acOutputReport, strREPORTNAME, acFormatSNP, strTEMPFILENAME, False 'don't start OLE app
Call SendMessage_Mail2
Else
DoCmd.OpenReport "Recall Notice", acViewNormal
End If
DoCmd.Close acForm, "poc_form"
List0.Selected
= False
End If
Next x
Set ctrl = Nothing
End If
I have a listbox that contains the names of people I would like to send an attached report via email to. The listbox is set to have multiple selections. I have a button at the botton of the screen that when pressed will initiate the emailings.
What I would like to have happen is that as each email is sent out, that selected person in the listbox unselects. The user would be able to see items unselecting as this process works. I have the emailing working except for the unselecting process...I just can't get that working. Below is my code. Can someone tell me where I'm going wrong at?
Dim ctrl As Control
Dim x As Integer
Dim y As Integer
If List0.ItemsSelected.Count > 0 Then
Set ctrl = [List0]
y = List0.ItemsSelected.Count
For x = y To 1 Step -1
If List0.ItemsSelected.Count = 0 Then
Else
Me![Activity] = ctrl.Column(1, List0.ItemsSelected(x - 1))
Me![POC] = ctrl.Column(0, List0.ItemsSelected(x - 1))
DoCmd.OpenForm "poc_form", acNormal, , , acFormEdit, acIcon
Forms![poc_form].RecordSource = "Email_Recall2"
If Forms![poc_form]![E_Mail_Recall] = "y" Then
Dim strREPORTNAME As String
Dim strTEMPFILENAME As String
strREPORTNAME = "Recall Notice"
strTEMPFILENAME = "C:\App\Recall.snp"
DoCmd.OutputTo acOutputReport, strREPORTNAME, acFormatSNP, strTEMPFILENAME, False 'don't start OLE app
Call SendMessage_Mail2
Else
DoCmd.OpenReport "Recall Notice", acViewNormal
End If
DoCmd.Close acForm, "poc_form"
List0.Selected
End If
Next x
Set ctrl = Nothing
End If