Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ActiveX control only shows first page in Access 2000

Status
Not open for further replies.

B19

Programmer
Jun 19, 2001
6
US
I have a form used to generate reports. It loops over a recordset and prints the reports to a postscript or .pdf file. The report will preview correctly in Crystal, but not Access 2000. At best, it will show the first page of the report, but the report file need to be open in Crystal to even get that far. If Crystal is not open, the preview window flashes by and nothing happens.

The Crystal Report Control is set as a reference on the form.

Thanks for any help.

Here is the code:

Private Sub btnPrintMe_Click()
Dim dbs As Connection
Dim rstPrintThis As New ADODB.Recordset

Dim strDeleteThis As String
Dim strInsertThis As String
Dim strReportName As String
Dim intPrint As Integer
Dim intRecCount As Integer

Set dbs = CurrentProject.Connection

rstPrintThis.Open "SELECT * FROM participantList where empid=32731 ORDER BY empID", dbs, adOpenStatic


DoCmd.SetWarnings False

rstPrintThis.MoveLast
intRecCount = rstPrintThis.RecordCount

rstPrintThis.MoveFirst

Do Until rstPrintThis.EOF

strDeleteThis = "DELETE FROM reportIDList"
DoCmd.RunSQL (strDeleteThis)

strReportName = "c:\temp\in\" & Trim(Str(rstPrintThis!empID)) & ".pdf"

Debug.Print rstPrintThis!empID


strInsertThis = "INSERT INTO reportIDList (currentRptID) VALUES (" & Str(rstPrintThis!empID) & ")"
Debug.Print strReportName
DoCmd.RunSQL (strInsertThis)

With crystalRptControl
.ReportFileName = "C:\currentjobs\\IndividualReportFinal.rpt"
.Destination = crptToWindow
.PrintReport
End With

'SendKeys "c:\temp\in\" & Trim(Str(rstPrintThis!empID)) & ".pdf{ENTER}"
'crystalRptControl.PrintReport

rstPrintThis.MoveNext
Loop

DoCmd.SetWarnings True

End Sub
 
For the above post, I am using Crystal 8.5, Access 2000 & Windows 2000.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top