Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Server Not Open
Message
From
25/08/2008 11:14:48
 
General information
Forum:
Visual FoxPro
Category:
Crystal Reports
Title:
Miscellaneous
Thread ID:
01341241
Message ID:
01341524
Views:
12
Glad you got it working. Note that if you store the username and password as part of the DSN, then the solution in my article works fine.

>Ok, since no body has an answer for my question, I thought it would be uselful for someon latter one to know about the solution i've found. I think i didn't explained myself the right way so must of people seeing my thread made some assumptions about the knowledge of mine about crystal reports. here it is the piece of code that gave me the solution to my problem
>
>
>'Add a command button and a Crystal Report Viewer Control to you form
>'Reference Crystal Reports 8/8.5/9/10 ActiveX Designer Run time Library
>'Paste the following code into the form code window
>'Change the path "C:\crtests\Report1.rpt" to suit yours
>
>Private Sub Command1_Click()
>    Dim CrxApp As CRAXDRT.Application
>    Dim CrxRep As CRAXDRT.Report
>    Dim crxDatabase As CRAXDRT.Database
>    Dim crxDatabaseTables As CRAXDRT.DatabaseTables
>    Dim crxDatabaseTable As CRAXDRT.DatabaseTable
>
>    Set CrxApp = New CRAXDRT.Application
>    Set CrxRep = CrxApp.OpenReport("H:\test\crtests\Report1.rpt")
>
>    'Set your Database object to the Report object's Database object
>    Set crxDatabase = CrxRep.Database
>
>    'Set your DatabaseTables object to the Database object's Tables object
>    Set crxDatabaseTables = crxDatabase.Tables
>
>    'Loop through each DatabaseTable object in the DatabaseTables collection and then set the location
>    'of the database file for each table
>
>    For Each crxDatabaseTable In crxDatabaseTables
>        'If you are using physical path of the access database file (Native connection to PC database)
>        crxDatabaseTable.Location = App.Path & "\xtremelite.mdb"
>
>        'Use next line, if you are using Native connection to SQL database
>        'crxDatabaseTable.SetLogOnInfo "servername", "databasename", "userid", "password"
>
>        'Use next line, if you are using ODBC connection to a PC or SQL database
>        'HERE IS ACCTUALLY THE ANSWER OF MY QUESTION
>        'crxDatabaseTable.SetLogOnInfo "ODBC_DSN", "databasename", "userid", "password"
>    Next crxDatabaseTable
>
>
>    CRViewer91.ReportSource = CrxRep
>    CRViewer91.ViewReport
>
>    Set crxDatabase = Nothing
>    Set crxDatabaseTable = Nothing
>    Set crxDatabaseTables = Nothing
>    Set crxReport = Nothing
>    Set crxApplication = Nothing
>
>End Sub
>
>
>
>Maybe this could be uselful for somebody looking for the same
>best regards
Craig Berntson
MCSD, Microsoft .Net MVP, Grape City Community Influencer
Previous
Reply
Map
View

Click here to load this message in the networking platform