Newman
Québécois
- Local time
- Today, 00:30
- Joined
- Aug 26, 2002
- Messages
- 766
I have a module that, every nights, opens a report and sends it by e-mail to the person the records belong to in a snapshot format. (It's code follows this message...)
It's been working fine for a couple of months, but started to act crazy last weekend.
Sometimes, it sends more snp files than it should. The customer receives the snp file that belongs to him and snp files that belong to someone else but from a different night.
ie: Last night, Mr.X got his snp file with his records from yesterday. That's fine!
But he also got snp files with records of last week from Mr.Y. That's not fine at all!
Do any of you have an idea where the problem comes from?
Many thanks.
It's been working fine for a couple of months, but started to act crazy last weekend.
Sometimes, it sends more snp files than it should. The customer receives the snp file that belongs to him and snp files that belong to someone else but from a different night.
ie: Last night, Mr.X got his snp file with his records from yesterday. That's fine!
But he also got snp files with records of last week from Mr.Y. That's not fine at all!
Do any of you have an idea where the problem comes from?
Many thanks.
Code:
Public Sub EnvoyerThermoRealisee()
Dim DB As Connection
Dim rsThermoRealisee As New ADODB.Recordset
Set DB = CurrentProject.Connection
With rsThermoRealisee
.Open "SELECT DISTINCT AdresseMessagerie FROM RThermoRealisee", DB, adopenstatic, adlockoptimistic
If .RecordCount = 0 Then Exit Sub
.MoveFirst
Do Until .EOF
strAdresse = rsThermoRealisee.Fields(0)
DoCmd.OpenReport "EThermoRealisee", acViewDesign
Report_EThermoNonAutorise.FilterOn = False
Report_EThermoRealisee.Filter = "[AdresseMessagerie]='" & strAdresse & "'"
Report_EThermoNonAutorise.FilterOn = True
DoCmd.SendObject acSendReport, "EThermoRealisee", acFormatSNP, strAdresse, , , "Thermo réalisée", "Veuillez trouver ci-joint la liste des thermo réalisées à votre demande.", False
DoCmd.Close acReport, "EThermoRealisee", acSaveNo
.MoveNext
Loop
.Close
DB.Close
End With
End Sub