how to update a Crystal Report connected to variant num of columns

Posted on 2001-07-08
Last Modified: 2009-07-29
I trying to add a Crystal Report to my project and to connect this report to a table that has changeable number of columns , Do I have to add this table in a special way and How can I update this report in the run time
Question by:Viki

Expert Comment

Comment Utility
try this

'Create Temp StorageDim strSelect As String'Create Report instance
Dim Report As New UIBenSummrpt 'Set Mouse Pointer to busy
Screen.MousePointer = vbHourGlass'Set Crystal Reports smartviewer source
'     to reportCRViewer1.ReportSource = Report 'Reset Reports selection criteria
Report.RecordSelectionFormula = "" 'Create a string for selection criteria
strSelect = "{ado.Client}= '" & strClient & "' AND " & "{ado.Year}= '" & strYear & "'"
'Set Report's selection criteriaReport.RecordSelectionFormula = strSelect
'Display ReportCRViewer1.ViewReport 'Reset the mouse pointer icon
Screen.MousePointer = vbDefault

hope this helps

Accepted Solution

andysalih earned 100 total points
Comment Utility
or this

'Add the crystal ocx object to form (wil'     l be named CrystalReport1)
' you can pass record selection''NOTE''Create the report in Crystal first and
'     place the report in the same directory a'     s your database.
'' Set the report location to same as da'     tabase in Crystal
''This part is run from menu or command '     button
CrystalReport1.ReportSource = crptReport
CrystalReport1.ReportFileName = reportpath & "\YOUR_REPORT_NAME.rpt"
'***This line only is using single recor'     d selection
CrystalReport1.ReplaceSelectionFormula ("{TABLENAME.FIELDNAME} =" & "'" & v_choice & "'")
'*********CrystalReport1.WindowState = crptMaximizedCrystalReport1.PrintReport
CrystalReport1.PageZoom (50)          

hope you can build of these



Expert Comment

Comment Utility
have a look at the following link, i dont know if thats something which you could use to build off

hope this helps
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.


Expert Comment

Comment Utility

Author Comment

Comment Utility
let me make it clearer.
let say i have 3 field objects on a report.
then on runtime i wanna  add more fields objects to represent other new columns.
how do i add those objects?
i think it's equivalent to "createobject (textbox) "
or loading a new textbox in array in VB.

LVL 49

Expert Comment

Comment Utility
Hi Viki,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept andysalih's comment(s) as an answer.

Viki, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept this comment as an answer.
DanRollins -- EE database cleanup volunteer

Expert Comment

Comment Utility
Comment from expert accepted as answer

E-E Moderator

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now