pedie
Well-known Member
- Joined
- Apr 28, 2010
- Messages
- 3,875
Hi, I need to achieve this task please advice.</SPAN></SPAN>
I need to generate report about a 100 of them into .pdf format.</SPAN></SPAN>
My report source is query and query refers to form controls for x criteria…</SPAN></SPAN>
I need to make sure that my source is refreshed overtime x value in form is changed so that it will export correct report.
I have hilighted in the code ''REFRESH MY SOURCE HERE'
Below is mycode. </SPAN></SPAN>
I need to generate report about a 100 of them into .pdf format.</SPAN></SPAN>
My report source is query and query refers to form controls for x criteria…</SPAN></SPAN>
I need to make sure that my source is refreshed overtime x value in form is changed so that it will export correct report.
I have hilighted in the code ''REFRESH MY SOURCE HERE'
Below is mycode. </SPAN></SPAN>
Code:
[/FONT][FONT=courier new]Dim x As String, y As String, z As String
Dim Rst As DAO.Recordset
Set Rst = CurrentDb.OpenRecordset("xdatatable", dbOpenDynaset)[/FONT]
[FONT=courier new] If Not (Rst.BOF And Rst.EOF) Then
Rst.MoveFirst
While Not Rst.EOF
[/FONT]
[FONT=courier new] If Len(Rst![Export Fld Pth].Value & vbNullString) <> 0 Then
z = Rst![Export Fld Pth]
End If
If Len(Rst![CC Ind].Value & vbNullString) <> 0 Then
x = Rst![CC Ind]
Me.Controls(x).Value = Rst![Cost Center]
End If
If Len(Rst![Loc Ind].Value & vbNullString) <> 0 Then
y = Rst![Loc Ind]
Me.Controls(y).Value = Rst![Location]
End If
[U]
[B]'REFRESH MY SOURCE HERE[/B][/U][/FONT]
[FONT=courier new] DoCmd.OutputTo acOutputReport, "xreport1", acFormatPDF, z & "\samplereport" & Rnd() & ".pdf", False
Rst.MoveNext
Wend
End If
If Not Rst Is Nothing Then
Rst.Close
Set Rst = Nothing
End If
[/FONT]
[FONT=courier new]