P
Peter Adema
In Access I try to send automatically several e-mails.
I have a data table with ± 2500 records and an adres table
with 34 records.
In visual basic I do the next steps:
I open a query and filter on the branch I need. The I send
the mail as an XLS format to the found recipient.
After two mails, I get an error message, that I do not
have enough memory. According to out IT-people this is
not the case.
I can send two mails, but if the Address table has more addressen, I get a
memory error.
This is a part of the VB coding:
Private Sub mail_Click()
On Error GoTo Err_mail_Click
Dim kantoor As String
Dim mail As String
Dim mail2 As String
Dim dbsyti As DAO.Database
Dim rstadres As DAO.Recordset
DoCmd.SetWarnings off
Set dbsyti = CurrentDb()
Set rstadres = dbsyti.OpenRecordset("adres", dbOpenDynaset)
With rstadres
Do Until .EOF
mail = !
kantoor = ![ktr]
mail2 = ![email2]
If mail2 <> "nvt" Then
DoCmd.OpenQuery "q_output", acViewNormal,
acEdit
DoCmd.ApplyFilter , "branch =""" & kantoor
& """"
DoCmd.SendObject acSendQuery, "Q_output",
acFormatXLS, mail, mail2, , "Nog te factureren dossiers
kantoor """ & kantoor & """", " **AUTOMATISCHE MAIL**" ,
False
Else
DoCmd.OpenQuery "q_output", acViewNormal, acEdit
DoCmd.ApplyFilter , "branch =""" & kantoor
& """"
DoCmd.SendObject acSendQuery, "Q_output",
acFormatXLS, mail, , , "Nog te factureren dossiers
kantoor """ & kantoor & """", "**AUTOMATISCHE MAIL**",False
End If
DoCmd.Close
.MoveNext
Loop
End With
rstadres.Close
DoCmd.SetWarnings warningson
Exit_mail_Click:
Exit Sub
Err_mail_Click:
MsgBox Err.Description
Resume Exit_mail_Click
End Sub
I have a data table with ± 2500 records and an adres table
with 34 records.
In visual basic I do the next steps:
I open a query and filter on the branch I need. The I send
the mail as an XLS format to the found recipient.
After two mails, I get an error message, that I do not
have enough memory. According to out IT-people this is
not the case.
I can send two mails, but if the Address table has more addressen, I get a
memory error.
This is a part of the VB coding:
Private Sub mail_Click()
On Error GoTo Err_mail_Click
Dim kantoor As String
Dim mail As String
Dim mail2 As String
Dim dbsyti As DAO.Database
Dim rstadres As DAO.Recordset
DoCmd.SetWarnings off
Set dbsyti = CurrentDb()
Set rstadres = dbsyti.OpenRecordset("adres", dbOpenDynaset)
With rstadres
Do Until .EOF
mail = !
kantoor = ![ktr]
mail2 = ![email2]
If mail2 <> "nvt" Then
DoCmd.OpenQuery "q_output", acViewNormal,
acEdit
DoCmd.ApplyFilter , "branch =""" & kantoor
& """"
DoCmd.SendObject acSendQuery, "Q_output",
acFormatXLS, mail, mail2, , "Nog te factureren dossiers
kantoor """ & kantoor & """", " **AUTOMATISCHE MAIL**" ,
False
Else
DoCmd.OpenQuery "q_output", acViewNormal, acEdit
DoCmd.ApplyFilter , "branch =""" & kantoor
& """"
DoCmd.SendObject acSendQuery, "Q_output",
acFormatXLS, mail, , , "Nog te factureren dossiers
kantoor """ & kantoor & """", "**AUTOMATISCHE MAIL**",False
End If
DoCmd.Close
.MoveNext
Loop
End With
rstadres.Close
DoCmd.SetWarnings warningson
Exit_mail_Click:
Exit Sub
Err_mail_Click:
MsgBox Err.Description
Resume Exit_mail_Click
End Sub