Saving Crystal report8.5 using VB6.0

How to save CRAXDRT.Report using VB6.0

Page 1 of 1

3 Replies - 5681 Views - Last Post: 23 April 2009 - 02:12 AM Rate Topic: -----

#1 challenge  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 23-April 09

Saving Crystal report8.5 using VB6.0

Posted 23 April 2009 - 12:25 AM

Hi all,
I am adding some default values to Crsytal report parameter in VB6.0 Later i want to save the report. My code is looking like this.

	Dim CrRep As CRAXDRT.Report
				 
				' Add default values to CR parameter
				...............

				'Save the report
	CrRep.SaveAs("D:\TOOLS\",cr80FileFormat)
	



While saving, it is showing error as "syntax error"
Can anybody tell me what is the syntax for saving a crystal report using VB6.0

This post has been edited by challenge: 23 April 2009 - 12:39 AM


Is This A Good Question/Topic? 0
  • +

Replies To: Saving Crystal report8.5 using VB6.0

#2 firebolt  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 92
  • View blog
  • Posts: 5,561
  • Joined: 20-February 09

Re: Saving Crystal report8.5 using VB6.0

Posted 23 April 2009 - 12:40 AM

Have a look here.
http://www.vb6.us/tu...ts-vb6-tutorial

And I dont think there is meant to be another " \ " after tools.
Was This Post Helpful? 0
  • +
  • -

#3 challenge  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 3
  • Joined: 23-April 09

Re: Saving Crystal report8.5 using VB6.0

Posted 23 April 2009 - 01:25 AM

Thanku for the reply...

But, acutally that doc doesn't contain what i mean.

That doc gives information about printing the Crystal report.
But i want to save the crystalreport using VB6.0

kindly view code once here

	Dim CrApp As CRAXDRT.Application
	Dim CrRep As CRAXDRT.Report
	Dim rs As New ADODB.Recordset
	Dim MyConnectionString As String 'for the connection string
	Dim db As New ADODB.Connection
	Dim sPath As String ' here we put the path of your database
	Dim sSQL As String 'your SQL Statement


	Set CrApp = New CRAXDRT.Application
	Set CrRep = CrApp.OpenReport("D:\TOOLS\Open CR From VB\report1.rpt")

	MyConnectionString = "Provider=SQLOLEDB.1;Password=tempword;Persist Security Info=True;User ID=abc;Password=temp;Initial Catalog=dbname;Data Source=datasrc"
	db.ConnectionString = MyConnectionString
	db.Open
	sSQL = "Select empid,ename from emp"
	With rs
		.ActiveConnection = db
		.LockType = adLockOptimistic
		.CursorType = adOpenKeyset
		.Open sSQL
		Do While Not .EOF
			CrRep.ParameterFields(2).AddDefaultValue rs.Fields(0).Value
			CrRep.ParameterFields(2).NthValueDescription(rs.Fields(0).Value) = rs.Fields(1).Value
			.MoveNext
		Loop
	CrRep.ParameterFields(2).EnableShowDescriptionOnly = True
	CrRep.SaveAs("D:\TOOLS\Open CR From VB\", cr70FileFormat)
	
	 'Preview the report
	CRViewer2.ReportSource = CrRep
	CRViewer2.ViewReport
	
	End With
   'Release the references
	rs.Close
	Set rs = Nothing
	Set CrRep = Nothing
	Set CrApp = Nothing





This stmt gives syntax error
CrRep.SaveAs("D:\TOOLS\Open CR From VB\", cr70FileFormat)

kindly refer that.
Was This Post Helpful? 0
  • +
  • -

#4 firebolt  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 92
  • View blog
  • Posts: 5,561
  • Joined: 20-February 09

Re: Saving Crystal report8.5 using VB6.0

Posted 23 April 2009 - 02:12 AM

I'm not sure but does this (below) need the last back slash.
D:\TOOLS\Open CR From VB\ '<<<<


Was This Post Helpful? 0
  • +
  • -

Page 1 of 1