Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Dynamic Connect to Database at Run Time 1

Status
Not open for further replies.

Trusts

Programmer
Feb 23, 2005
268
US
Hi all,

I am using CR 8.5. I have a report that I set to a particular database while using CR. In a VB6 app I have a form with the Crystal Reports Control. The report will run fine given the database is the same.

I am sharing the development of the application with someone at another location. I am trying to figure out how, in VB, to override the embedded (for lack of a better word) database info in the CR report itself. In other words, by changing one or more constants in our code, can we get the report to point to our respective local database when we individually run it.

I see the CR control on the VB form has a number of properties, such as .Connect and .Datasource that seem like I could use these to change the database connection. I was unsuccessful using the .Connect property by itself. It did not overwrite the database pointer in the report. So any examples of VB code to get this done would be great.

This is already how we change which SQL Server we each use. We each have a Global Const in a seperate module that contains our connection string. Our respective connections differ, but since only the const is referenced elsewhere in the code when establishing an ADO connection, every works fine. Now, if we could just get the same approach working for the report that would be great.

Thanks!
 
Thanks Vidru,

I am using the ocx since it is an old app I am adding to, and the other developer is not in the frame of mind to try anything new.

Thanks for the links. Looks like just what I need.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top