Go Back   Access World Forums > Apps and Windows > Crystal Reports

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 05-04-2019, 09:29 PM   #1
Ryobi
Newly Registered User
 
Join Date: Mar 2012
Posts: 33
Thanks: 1
Thanked 1 Time in 1 Post
Ryobi is on a distinguished road
Coding for connection and data binding

Hello,


I am using Vb.net 2017. I have created a crystal report and connected an msaccess database to the report and have added fields using the connection on the crystal report. I would like to code the connection my self since the I want the database to place in different place in case I want to put in different folders.
The problem that I have is where do I put the code. I do not see any where on the crystal report form where I can place the code. Any ideas or suggestions are welcome.


Thank

Ryobi is offline   Reply With Quote
Old 05-07-2019, 06:52 PM   #2
Ryobi
Newly Registered User
 
Join Date: Mar 2012
Posts: 33
Thanks: 1
Thanked 1 Time in 1 Post
Ryobi is on a distinguished road
Re: Coding for connection and data binding

In case somebody is wondering how is done the code is shown below:

Dim cr As New CrystalReport1
cr.Load(strReportPath)
cr.SetDataSource(ds.Tables("Mytable"))

CrystalReportViewer1.ReportSource = cr

CrystalReportViewer1.Refresh()


Place above code at the load event of the Crystal Report Viewer Form.


Note: The code for loading and extracting data from the database is not shown,
but a connection to the database must be made in order to load the data into the ds.table
other wise you will get an an error because ds.Table is not defined.
Ryobi is offline   Reply With Quote
Reply

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Binding Data to a ListView reb0101 General 0 07-10-2013 11:31 AM
binding data to listbox jamesmor VB.NET 1 11-10-2010 11:33 PM
Coding an ODBC connection WSC General 0 03-17-2008 06:11 AM
Binding Passed Data Matty VB.NET 12 08-18-2006 03:21 PM
[SOLVED] binding data to a calander control jamesdawson Modules & VBA 2 11-07-2002 06:54 PM




All times are GMT -8. The time now is 01:11 PM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World