Solved

Crystal Reports VB6 Logon

Posted on 2014-04-07
8
1,138 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 100

Accepted Solution

by:
mlmcc earned 500 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 100

Assisted Solution

by:mlmcc
mlmcc earned 500 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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 100

Assisted Solution

by:mlmcc
mlmcc earned 500 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 100

Assisted Solution

by:mlmcc
mlmcc earned 500 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

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

There have always been a lot of questions related to when Crystal Reports evaluates report components (such as formulas, summaries, cross-tabs, charts, to name a few examples). Crystal Reports uses a two-pass reporting process to provide greater …
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…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

726 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