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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

RDC and VBscript

Status
Not open for further replies.

icarus5000

Technical User
May 15, 2003
16
US
Hi,

I have a general question regarding the crystal RDC and VBScript.

Currently I'm using the Crystal API to automate the running of over 500 reports which are exported to a file server as pdf. I'm using a VBA app on a workstation but now its time to migrate to the RDC and run these suckers on a real box.

I'm not doing anything fancy with the reports. Just need to login to the database and pass a few parameters.

Is is possible to do all this in a VBS file. My knowledge of VB is intermediate but I don't know anything about VBScript and it's limitations.

Thanks,
Ic


 
Do you have an ODBC setup to access your database?
After connecting to the data base it would be the same functions that you would use in VB..

SQL = "Select * from tablename where userid = '" & inputuserid & "' and password = '" & inputpassword & "'

Set rs = CreateObject("ADODB.Recordset")
Set rs = conn.execute(SQL)

on your form just have an inputuserid and inputpassword..

hope this helps..
 
Here's the RDC vba code I have so far. I'm trying to run this in VBscript on a server to churn out 500+ reports for 100 clients. I have yet to include the various loops through the recordsets to pass the parameters.

Public Sub ExportPDF()
Dim crxApplication As New CRAXDRT.Application
Dim Report As CRAXDRT.Report

crxApplication.LogOnServer "p2sodbc.dll", "DB", "clients", "username", "password"

Set Report = crxApplication.OpenReport("C:\monthlyreports\CompletionReport.rpt")

Report.ParameterFields.GetItemByName("@CompID").AddCurrentValue "XYZ"
Report.ParameterFields.GetItemByName("@Month").AddCurrentValue 2

Report.ExportOptions.FormatType = crEFTPortableDocFormat
Report.ExportOptions.DestinationType = crEDTDiskFile
Report.ExportOptions.DiskFileName = "C:\MyPDFfile.pdf"
Report.Export False

crxApplication.LogOffServer "p2sodbc.dll", "DB1", "clients", "username", "password"

Set Report = Nothing
Set crxApplication = Nothing
End Sub
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top