Changing source Programmatically for Crystal Reports.

Troy

Well-known member
Joined
Feb 7, 2005
Messages
153
Programming Experience
10+
Hello everyone.

I know there are numerous listing here on people having this trouble but After reading through several I am even more confused than ever.

I have no problems generating and changing fields for my Crystal Reports in VB 2005.

However I need to change the Database location programmatically. The wizard works great for generating a form and I can create one by binding my Database to it. But My program is setup to allow my clients to select the Database they wish to work with and that means it's not in the same location all the time. So I need to change the Crystal Reports Database Location.

I'm a bit confused on where to find the code thats telling the form to use my database to populate it to begin with.

I've Looked throught the CrystalReports1.vb file and I don't see anywhere, where it calls for my Database Path. So where do I find it to alter it?

or how can I take an already created form CrystalReport1.rpt and have it work with the currently selected Database not the one that generated the form to begin with.

Thankyou for any help offered.
 
ok Nevermind I found how to do it here, http://www.vbforums.com/showthread.php?t=437587. I do however need to know how I can use my reports that are within my project instead of having them load from an external folder.

For Example the following code I know Loads the report form from a folder but I want it to use a resource in my code:

VB.NET:
[SIZE=2][COLOR=#008000]'Report In the report Folder [/COLOR][/SIZE]
[SIZE=2]Report.Load(Application.StartupPath & [/SIZE][SIZE=2][COLOR=#a31515]"/Reports/"[/COLOR][/SIZE][SIZE=2] & ReportName & [/SIZE][SIZE=2][COLOR=#a31515]""[/COLOR][/SIZE][SIZE=2])[/SIZE]
[SIZE=2]Report.SetDataSource(DataSet)[/SIZE]
 
Back
Top