Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Crystal Reports VB6 Logon

Posted on 2014-04-07
8
Medium Priority
?
1,219 Views
Last Modified: 2014-04-08
Hello Experts,

I am trying to run a Crystal Report thorugh VB6. Here is my code:

Dim crxApp As CRAXDRT.Application
Dim crxRpt As CRAXDRT.Report


    Set crxApp = New CRAXDRT.Application
    Set crxRpt = crxApp.OpenReport(App.Path & "\Reports\DetailRecpt.rpt")
    crxRpt.ParameterFields(1).AddCurrentValue ("44444") 'testing with trans# 44444


CRViewer.ReportSource = crxRpt
CRViewer.ViewReport

Open in new window


It generates this error:

---------------------------
Crystal Report Viewer
---------------------------
Logon failed.
Details: 28000:[Sybase][ODBC Driver][SQL Anywhere]Invalid user ID or password [Database Vendor Code: -103 ]
---------------------------
OK  
---------------------------


I don't have any login info within my VB code as you can see. I cant seem to figure out the syntax for the connection string. I have successfully used this connection string in the past to connect.

"Driver={SQL Anywhere 10};Password=password;Persist Security Info=True;User ID=user;Data Source=sqlbase;Location=sqlbase"


Any help would be appreciated.
0
Comment
Question by:triphen
  • 4
  • 4
8 Comments
 
LVL 101

Accepted Solution

by:
mlmcc earned 2000 total points
ID: 39984245
Have you tried using the code you say solved your other issue along the same lines?

http://www.experts-exchange.com/Programming/Languages/Visual_Basic/Q_28404831.html

mlmcc
0
 

Author Comment

by:triphen
ID: 39984431
m1mcc,

Thanks for your response. The solution I accepted there worked but when I moved the EXE out of my development environment it not generates that logon error. I am sure it's because I dont have any connection string in my code, however I dont know the syntax :/
0
 
LVL 101

Assisted Solution

by:mlmcc
mlmcc earned 2000 total points
ID: 39984554
There is code provided in the other question that should work.  Crystal doesn't use a connection string as such.  

The code is here

http://www.experts-exchange.com/Programming/Languages/Visual_Basic/Q_28404831.html#a39977258

mlmcc
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:triphen
ID: 39984569
Private Sub SetReportLocation(ByRef RepObj As CRAXDRT.Report)

    Dim CrxDDF As CRAXDRT.DatabaseTable
    Dim CP As CRAXDRT.ConnectionProperties

    For Each CrxDDF In RepObj.Database.Tables
        Set CP = CrxDDF.ConnectionProperties
        CP.DeleteAll
        CP.Add "Connection String", "Driver={SQL Anywhere 10};Password=password;Persist Security Info=True;User ID=user;Data Source=sqlbase;Location=sqlbase"
    Next

    Set CrxDDF = Nothing
    Set CP = Nothing

End Sub




Private Sub Form_Load()

Dim crxApp As CRAXDRT.Application
Dim crxRpt As CRAXDRT.Report

 SetReportLocation crxRpt


    Set crxApp = New CRAXDRT.Application
    Set crxRpt = crxApp.OpenReport(App.Path & "\Reports\DetailRecpt.rpt")
    crxRpt.ParameterFields(1).AddCurrentValue ("44444") 'testing with trans# 44444


CRViewer.ReportSource = crxRpt
CRViewer.ViewReport


End Sub

Open in new window



Generates:

RunTime error 91

Object variable or With Block variable not set
0
 
LVL 101

Assisted Solution

by:mlmcc
mlmcc earned 2000 total points
ID: 39984678
This line

SetReportLocation crxRpt

has to come after you instantiate the report obect

after this line

Set crxRpt = crxApp.OpenReport(App.Path & "\Reports\DetailRecpt.rpt")


mlmcc
0
 

Author Comment

by:triphen
ID: 39984685
Looks better, different error

---------------------------
Crystal Report Viewer
---------------------------
Logon failed.
Details: 28000:[Sybase][ODBC Driver][SQL Anywhere]Login mode 'Integrated' not permitted by login_mode setting [Database Vendor Code: -1074 ]
---------------------------
OK  
---------------------------
0
 
LVL 101

Assisted Solution

by:mlmcc
mlmcc earned 2000 total points
ID: 39984940
That means the connection string is wrong.  You have it set for Integrated Security and the reort probably isn't or the other ay round

mlmcc
0
 

Author Comment

by:triphen
ID: 39985284
CP.Add "ConnectionString", "Driver={SQL Anywhere 10};Uid=user;Pwd=password;DSN=sqlbase;"

This worked!
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

876 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question