a very bland heading I know
I have this report that needs to be export - 1 report per record
the report exports out but its the same record export out each time ( the name changes - but the data doesn't)
i am sure it simplies - but not seeing it ?
(I have tried the code down - as there was a lot of junk int here re emailing - but thats a side issue :banghead:
-
Private Sub Command0_Click()
Dim MyDb As DAO.Database
Dim rsemail As DAO.Recordset
Dim RefernceNumber As String
Dim FilenameZ As String
Set MyDb = CurrentDb()
Set rsemail = MyDb.OpenRecordset("bondqry", dbOpenSnapshot)
Dim FilterZ As String
Dim strID As String
Dim i As Integer
For i = 0 To rsemail.RecordCount
rsemail.MoveNext
Next i
'DoCmd.OutputTo acOutputReport, "Reportname", acFormatRTF, "S:\Test Data\xxxx\Policy\" &.Fields(6) & ".Doc", False
With rsemail
.MoveFirst
Do Until rsemail.EOF
strID = rsemail.Fields(6)
DoCmd.OpenReport "Bondreport", acViewPreview, , "RefernceNumber=" & rsemail.Fields(6) & ""
DoCmd.OutputTo acOutputReport, , acFormatRTF, "c:\Test\" & .Fields(6) & ".Doc", False
If IsNull(.Fields(11)) = False Then
sToName = .Fields(11)
sSubject = "whatever: " & "stuff"
sMessageBody = "Email Body Text "
End If
.MoveNext
Loop
End With
Set MyDb = Nothing
Set rsemail = Nothin
I have this report that needs to be export - 1 report per record
the report exports out but its the same record export out each time ( the name changes - but the data doesn't)
i am sure it simplies - but not seeing it ?
(I have tried the code down - as there was a lot of junk int here re emailing - but thats a side issue :banghead:
-
Private Sub Command0_Click()
Dim MyDb As DAO.Database
Dim rsemail As DAO.Recordset
Dim RefernceNumber As String
Dim FilenameZ As String
Set MyDb = CurrentDb()
Set rsemail = MyDb.OpenRecordset("bondqry", dbOpenSnapshot)
Dim FilterZ As String
Dim strID As String
Dim i As Integer
For i = 0 To rsemail.RecordCount
rsemail.MoveNext
Next i
'DoCmd.OutputTo acOutputReport, "Reportname", acFormatRTF, "S:\Test Data\xxxx\Policy\" &.Fields(6) & ".Doc", False
With rsemail
.MoveFirst
Do Until rsemail.EOF
strID = rsemail.Fields(6)
DoCmd.OpenReport "Bondreport", acViewPreview, , "RefernceNumber=" & rsemail.Fields(6) & ""
DoCmd.OutputTo acOutputReport, , acFormatRTF, "c:\Test\" & .Fields(6) & ".Doc", False
If IsNull(.Fields(11)) = False Then
sToName = .Fields(11)
sSubject = "whatever: " & "stuff"
sMessageBody = "Email Body Text "
End If
.MoveNext
Loop
End With
Set MyDb = Nothing
Set rsemail = Nothin