Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP-RDC Preview report
Message
From
11/03/2005 09:38:27
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
VFP-RDC Preview report
Miscellaneous
Thread ID:
00994806
Message ID:
00994806
Views:
60
Hi all,

I run this:

do form screen form src_vfp_rdc_preview.scx
which in the preview button this code below and always got in the preview
section : Messagebox displayed :

LOGON FAILED

What this error means, please help to explain ?
TIA
*!* Define the Crystal Application, Report, Database, DatabaseTables and 
*!* DatabaseTable objects as global variables

public crxApplication
public crxReport
public crxDatabase
public crxDatabaseTables
public crxDatabaseTable

*!* Assign the Crystal Application and Report objects to their class types. 
*!* Unlike other development tools you have to assign the report type also

SET ASSERTS ON
ASSERT .f.

crxApplication = createobject("CrystalRuntime.Application")

*!* Open the report
crxReport = crxApplication.OpenReport("C:\crystal\preview.rpt")


************************************************

* Use the following code if you have a SQL based database, 
* or a database with a password

* Set the Database, DatabaseTables and DatabaseTable objects

* crxDatabase = crxReport.Database
* crxDatabaseTables = crxDatabase.Tables
* crxDatabaseTable = crxDatabaseTables.Item(1)

* Pass the database logon information "DSN or ServerName", "DatabaseName",
* "UserID", "Password"

* crxDatabaseTable.SetLogonInfo ("Server Name","Database","User ID","Password")

*****************************************************

*!* If the CRViewer is added to the form, with out any report to preview
*!* Visual FoxPro will give an error stating that the "OLECONTROL may be corrupt"
*!* This has to do with the drawing method of certain types of controls being designed 
*!* more specifically for Visual Basic. To get around this add the Smart Viewer
*!* to the form when you want to view the report and preview right away. If the
*!* preview method is not called you will get an error.

scr8_vfp_rdc_preview.AddObject("CRViewer1","olecontrol","CRViewer.CRViewer")

*!* Set the viewer to be the size of the form and visible.
scr8_vfp_rdc_preview.CRViewer1.width = scr8_vfp_rdc_preview.width
scr8_vfp_rdc_preview.CRViewer1.height = scr8_vfp_rdc_preview.height
scr8_vfp_rdc_preview.CRViewer1.Visible =.T.

*!* Attach the report to the viewer
scr8_vfp_rdc_preview.CRViewer1.reportsource = crxReport


*!* View the report
scr8_vfp_rdc_preview.CRViewer1.ViewReport
Reply
Map
View

Click here to load this message in the networking platform