Incorrect listcount returns

DentTec

Registered User.
Local time
Yesterday, 22:49
Joined
Apr 3, 2011
Messages
25
Hi

I have no idea why my list.listcount always returns 18. Anyone runs into this problem ? A2010

Thanks
 
Do you have any other info relevant to your problem - it is extremely vague.

Some code, query, error message???
 
Here is my code

Private Sub cmdEmailAll_Click()

'output all reports at once
Dim i As Long

Dim olApp As Object
Dim olMail As Object
Const olMailItem = 0

On Error Resume Next
Set olApp = GetObject(, "Outlook.Application")

If Err.Number = 429 Then
Err.Clear
'Outlook is not running; open Outlook with CreateObject
Set olApp = CreateObject("Outlook.Application")
End If



'for looping listbox entries
For i = 0 To Me.List0.ListCount - 1
'choose the ones with email only
If (Me.listWithEmails.Column(1, i)) = "" Then
Else

Me.listWithEmails.Selected(i) = True
Me.List0.Column(0, i)
clientSelected = Me.listWithEmails.Column(0, i)
fileToMailLocation = "C:\Desktop\" & clientSelected & ".pdf"
fileToMailLocation, False
DoCmd.OutputTo acOutputReport, "Monthly Statement", acFormatPDF, fileToMailLocation, False

Set olMail = olApp.CreateItem(olMailItem)
With olMail
.To = Me.listWithEmails.Column(1, i)
.subject = statementMonth & " Statement"

.Attachments.Add fileToMailLocation

.Display

End With
End If
Next i

Set olMail = Nothing
Set olApp = Nothing

End Sub

======================

If my list has less than 18 names then I have extra email(s) open without email address. If the list has more than 18 names then I have only the first 18 emails open.
 
How are you filtering your Monthly Statement report when you're using the OutputTo method?
 

Users who are viewing this thread

Back
Top Bottom