Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Crystal Reports VB6 Logon

Posted on 2014-04-07
8
Medium Priority
?
1,199 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
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.

 

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

I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…
Suggested Courses

705 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