Arthur Fuller
artful at rogers.com
Wed Jun 11 17:17:29 CDT 2003
I've been staring at the following code and toying with this and that and
now I'm so punchy I really need a fresh set of eyes.
Scenario:
- a listbox with extended select, pk in column(0)
- a proc that works, called from the loop presented below
- said listbox has headings ON
<code>
'---------------------------------------------------------------------------
------------
' Procedure : Send_Text_Confirmations
' DateTime : 6/11/2003 14:50
' Author : Arthur Fuller
' Purpose : Send confirmations not using Snapshot files, send generated
text instead
' : This code sends text email messages constaining the same data
as the snapshot
' : We use the report's data source directly to retrieve the
information we need.
'---------------------------------------------------------------------------
------------
'
Private Sub Send_Text_Confirmations()
Dim ctl As Control
Dim intPhysicalRow As Integer, intCurrentRow As Integer
Dim strWhere As String
Dim strReportName As String
Dim lng_PK_Of_Interest As Long
With Me
Set ctl = .Item_Selector_listbox
With ctl
'column headings seem to screw this code up but I can't figure out how
'to account for them
For intPhysicalRow = 0 To .ItemsSelected.Count - 1
intCurrentRow = ctl.ItemsSelected(intPhysicalRow)
If intPhysicalRow > 0 Then
lng_PK_Of_Interest = ctl.Column(0, intCurrentRow)
Debug.Print "Creating mail for Practicum Placement #: " &
lng_PK_Of_Interest
Send_Text_PMail lng_PK_Of_Interest
End If
Next intPhysicalRow
End With
MsgBox "Emails sent for " & ctl.ItemsSelected.Count & " Practica",
vbInformation, "Task Complete"
End With
On Error GoTo 0
Exit Sub
Send_Text_Confirmations_Error:
MsgBox "Error " & Err.Number & vbCrLf & _
Err.Description & vbCrLf & _
"in procedure Send_Text_Confirmations of VBA Document
Form_frm_Practica_Email_Select", _
vbCritical, _
"Program Error"
End Sub
</code
The line
Send_Text_PMail lng_PK_Of_Interest
Works and is not of interest. Just assume that whatever it does, it works.
The problem is in the arithmetic and I cannot see it.
Well, ok, I'm old, and entitled to more senior moments than you :-)
Symptoms:
Select 3 items. It does 2. Select 1. It does none. Select All and it works.
Headings off and on affect the results. I want the code to interrogate
HeadingsOn but can't seem to find the attribute.
Revisions invited!
Arthur