Hello,
I hope this is the best forum for this question.
I have the following line in my Active X script:-
Conn.Open "Provider=SQLOLEDB.1;Initial Catalog=Backup_Database;App=Crystal Export;Data Source=(local)", "dummy", "dummy"
Dummy has standard login and is a dbo user within the Backup_Database.
However when I try to run my code. I am getting the following error:-
0*8004005 (ADO Error Code). [DBNetLIB].ConnectionOpen(connect()).} SQL Server does not exist or access is deined.
This happens when I try to read from the SQL Server. My Code is shown below:-
Function Main()
Main = DTSTaskExecResult_Success
Const crEFTWordForWindows = 14
Const crEFTPortableDocFormat = 31
' Destination Types, again you can use VB to get other values for const def if you need to.
Const crEDTDiskFile = 1
Dim Conn 'ADO Connection
Dim Comm 'ADO Command
Dim Rcdset 'ADO Recordset
Dim App
Dim report 'Crystal Report
Dim DB 'Crystal Database
Dim Tables 'Crystal DatabaseTables
Dim Table1 'Crystal DatabaseTable
Dim currentpractice
currentpractice =a
Dim final
Set Conn = CreateObject("ADODB.Connection")
Set Comm = CreateObject("ADODB.Command")
Set Rcdset = CreateObject("ADODB.Recordset")
Msgbox("Hello1")
Conn.Open "Provider=SQLOLEDB.1;Initial Catalog=Backup_Database;App=Crystal Export;Data Source=(local)", "dummy", "dummy"
final = "Reports"
Rcdset.Open final, Conn, adOpenStatic, , adCmdTable
Msgbox("Hello2")
While (NOT Rcdset.EOF )
currentpractice = Rcdset.Fields.Item(1)
Msgbox(currentpractice)
Set App = CreateObject("CrystalRuntime.application.10") ' This is on a machine with Crystal 10
'Set App = CreateObject("CrystalRuntime.application.8.5") ' This is on a machine with Crystal 8.5
Set report = App.OpenReport("C:\Report\REPORT.rpt")
Msgbox("Hello3")
report.DiscardSavedData
Msgbox("Hello4")
Set DB = report.Database
Set Tables = DB.Tables
Set Table1 = Tables.Item(1)
report.ParameterFields.Item(1).AddCurrentValue (currentpractice)
Msgbox("Hello5")
report.ReadRecords --ERROR OCCURING
'Set our export options
report.ExportOptions.DestinationType = crEDTDiskFile
Report.PaperOrientation = crPortrait
Report.PaperSize = crPaperA4
report.ExportOptions.FormatType = crEFTPortableDocFormat
' report.ExportOptions.FormatType = crEFTWordForWindows
report.ExportOptions.DiskFileName = "C:\Reports_Generated\report.pdf" ' Path to where to drop PDF.
report.ExportOptions.PDFExportAllPages = True
' Export report without user interaction.
report.Export False
End Function
Any ideas?
Thanks
I hope this is the best forum for this question.
I have the following line in my Active X script:-
Conn.Open "Provider=SQLOLEDB.1;Initial Catalog=Backup_Database;App=Crystal Export;Data Source=(local)", "dummy", "dummy"
Dummy has standard login and is a dbo user within the Backup_Database.
However when I try to run my code. I am getting the following error:-
0*8004005 (ADO Error Code). [DBNetLIB].ConnectionOpen(connect()).} SQL Server does not exist or access is deined.
This happens when I try to read from the SQL Server. My Code is shown below:-
Function Main()
Main = DTSTaskExecResult_Success
Const crEFTWordForWindows = 14
Const crEFTPortableDocFormat = 31
' Destination Types, again you can use VB to get other values for const def if you need to.
Const crEDTDiskFile = 1
Dim Conn 'ADO Connection
Dim Comm 'ADO Command
Dim Rcdset 'ADO Recordset
Dim App
Dim report 'Crystal Report
Dim DB 'Crystal Database
Dim Tables 'Crystal DatabaseTables
Dim Table1 'Crystal DatabaseTable
Dim currentpractice
currentpractice =a
Dim final
Set Conn = CreateObject("ADODB.Connection")
Set Comm = CreateObject("ADODB.Command")
Set Rcdset = CreateObject("ADODB.Recordset")
Msgbox("Hello1")
Conn.Open "Provider=SQLOLEDB.1;Initial Catalog=Backup_Database;App=Crystal Export;Data Source=(local)", "dummy", "dummy"
final = "Reports"
Rcdset.Open final, Conn, adOpenStatic, , adCmdTable
Msgbox("Hello2")
While (NOT Rcdset.EOF )
currentpractice = Rcdset.Fields.Item(1)
Msgbox(currentpractice)
Set App = CreateObject("CrystalRuntime.application.10") ' This is on a machine with Crystal 10
'Set App = CreateObject("CrystalRuntime.application.8.5") ' This is on a machine with Crystal 8.5
Set report = App.OpenReport("C:\Report\REPORT.rpt")
Msgbox("Hello3")
report.DiscardSavedData
Msgbox("Hello4")
Set DB = report.Database
Set Tables = DB.Tables
Set Table1 = Tables.Item(1)
report.ParameterFields.Item(1).AddCurrentValue (currentpractice)
Msgbox("Hello5")
report.ReadRecords --ERROR OCCURING
'Set our export options
report.ExportOptions.DestinationType = crEDTDiskFile
Report.PaperOrientation = crPortrait
Report.PaperSize = crPaperA4
report.ExportOptions.FormatType = crEFTPortableDocFormat
' report.ExportOptions.FormatType = crEFTWordForWindows
report.ExportOptions.DiskFileName = "C:\Reports_Generated\report.pdf" ' Path to where to drop PDF.
report.ExportOptions.PDFExportAllPages = True
' Export report without user interaction.
report.Export False
End Function
Any ideas?
Thanks