Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 232
  • Last Modified:

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

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
1 Solution
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
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


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


hope this helps
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

VikiAuthor Commented:
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.

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
Comment from expert accepted as answer

E-E Moderator

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now