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

Error with server permissions

Status
Not open for further replies.

sdempsey

Programmer
Mar 23, 2005
36
GB
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











 
Make sure the account you uses to execute has permissions to the following folder.
C:\Report\REPORT.rpt and C:\Reports_Generated\report.pdf

Dr.Sql
Good Luck.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top