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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Connect to dataBase at run time from Vb

Status
Not open for further replies.

TarunAgarwal

Programmer
Nov 18, 2001
15
IN
Hi,

I am working with the Crystal Reports for first time. I want to know that how do I generate crystal reports using Vb and Access Database?

I want to provide the database path at the run time. That is the *.rpt file should have a configurable database connection.

Also, how do I fire queries from the Vb?

Please provide a sample code, if possible.

Regards,
Tarun
 
Provide your VB integration method ( faq149-237 )

Also, what type of query are you talking about, an MS Access query? Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
Thanks Ken,

I am using Vb6 and Crystal Reports 8. I am using a connection object to create connection to the Access Database.
Now I am able to connect to Access Database and fire Ms Access Queries. The problem now is that I am using a sub report within my report and I am not able to load Data to this sub report using CDO. I am able to achieve this in the main report, but not in the sub report.

Regards,
Tarun
 
stCriteria = "Your criteria" Eg "{Table.Name} = Textbox"
SummaryReport.ReportFileName = "X:\Path\report.rpt"
SummaryReport.LogonInfo(0) = DBCONNECT
SummaryReport.SubreportToChange = "SubreportName"
SummaryReport.LogonInfo(0) = DBCONNECT
SummaryReport.SubreportToChange = "" 'Changes back to main report
SummaryReport.LogonInfo(0) = DBCONNECT
SummaryReport.SelectionFormula = stCriteria
SummaryReport.PrintReport

DBConnect is your connection string an is of the format
"DSN=;UID=;PWD=;DSQ="
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top