Link to home
Start Free TrialLog in
Avatar of gautegutt
gautegutt

asked on

Crystal Report 11 not changing the login when running from Vb6

Hi everyone, great forum and lots of helpful stuff here.

I have built a small VB6 app that is suppose to open reports based on a command line coming in. this turned out to be pretty easy but now I can't get the report to change database and server when I send new information thru the VB6 code.

It does something as when I change the servername and database to something that doesnt exist it doesnt work. Is there something in the setup in the report that remembers connection or is overriding my code from VB. Any help would be appreciated.


 here is my code:

    Dim CrxApp As CRAXDRT.Application
    Dim CrxRep As CRAXDRT.Report
    Dim crxDatabase As CRAXDRT.Database
    Dim crxDatabaseTable As CRAXDRT.DatabaseTable
    Dim crxDatabaseTables As CRAXDRT.DatabaseTables

    Set CrxApp = New CRAXDRT.Application
    Set CrxRep = CrxApp.OpenReport("c:\Report1.rpt")

    Set crxDatabase = CrxRep.Database
    Set crxDatabaseTables = crxDatabase.Tables
   
    CrxRep.Database.LogOnServer "P2SODBC.DLL", "mynewdb", "mynewdb", "system", "admin"
   
 For Each crxDatabaseTable In crxDatabaseTables
    MsgBox crxDatabaseTable.Name
   
    crxDatabaseTable.SetLogOnInfo "SuperOfficeLocal","mynewdb", "mynewdb", "system", "admin"
 Next crxDatabaseTable
Avatar of frodoman
frodoman
Flag of United States of America image

Open the report in the crystal editor and make sure you don't have the "Save Data With Report" option checked.
Avatar of gautegutt
gautegutt

ASKER

Frodoman, the option is not checked for "save data with Report". there are a ton of other options there though I'm not sure which should be checked but right now these are:

database server is case-insensitive
use indexes or server for speed
display alerts on refresh
prompt for hyperlinks

nothing in the initial report part settings
update: I think this is all in the report, I'm not familiar with Crystal 11 and it seems to use the same tables instead of querying the ones in the code. the report does the same. can tables be linked to other database independant of the report connection ? these datbases are all on the same server.... if so how can I get all tables to be linked to the report datasource.

when I go set datasource location I have the following details:

Properties:
Database type: ODBC (RDO)
data source name: mynewdb
user Id: system
database mynewdb

on each table in there though I have the following properties:
tablename: address
table type: tables
catalog: originaldb
owner: sa
overridden qualified table name:



ASKER CERTIFIED SOLUTION
Avatar of jaanth
jaanth

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
thanks jaanth, thats exactly what was missing !

mucha ppreciated everyone who took the time and special thanks to jaanth