Link to home
Start Free TrialLog in
Avatar of ahpui
ahpui

asked on

specify database location for Crystal Report Chart in VB at runtime

hi guys,

I use Crystal Report control in my VB app to plot a chart with data from a database (mdb) located at app.path. At design time I specified the database location inside Crystal Report Designer in VB like this:- "Designer -> Database Fields -> Set Locaton -> File: ChartData!.\DBName.mdb". I believe the ".\" equivalent to App.Path. And I plot the chart using Chart Expert at design time. This approach works fine in Windows 98, NT and 2000. However, in XP, it gives me the follow error: File could not be found: "ChartData", at file location: "ChartData". Is there anyway I can specify the DB location and plot the chart at runtime using VB code instead of at design time. Thanks in advance! :)
Avatar of Mike McCracken
Mike McCracken

Yes there is.  What controls are you using in VB to call the report?

It sounds like the RDC.

The RDC object has a SetDataSource method.

This link may help

http://support.crystaldecisions.com/library/kbase/articles/c2002296.asp

mlmcc
Avatar of ahpui

ASKER

yes, I use RDC.

After I specified the location of the Database, how can I plot the chart programmatically? At design time I can use the Chart Expert but how about at runtime??
ASKER CERTIFIED SOLUTION
Avatar of Mike McCracken
Mike McCracken

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
Avatar of ahpui

ASKER

mlmcc,

I found out from one of the articles on the site you gave me. This is all I needed:

Report.Database.Tables(1).Location = "C:\myDatabase.mdb"

Thanks!

Still can't find anything about plotting a chart programmatically though. If you have any information on that please let me know. Later.
Avatar of ahpui

ASKER

not exactly what I am looking for but enough to get my problem solved. Thanks! :)