Pass value from vb form to crystal Report 9
Hi folks,
My apology if I have posted this in a wrong forum, which may be appropriately moved.
My post is this, I have a form in VB which allows the user to select a region from the combo. Based on the region selected the crystal report should display records [Acs 2003] for that relevant region. Iam just testing waters in CR so please be kind enough post the code & steps how to perform it or better a sample proj. I know there are somethings like parameterfield, formula field, variables in CR but I donot know :blush: how to use them.
Thanks in advance. :wave:
Re: Pass value from vb form to crystal Report 9
Moved to reporting section
Re: Pass value from vb form to crystal Report 9
You can use parameter for this type of purpose, Read how to add dynamic column In the CR at my Signature. :wave:
Re: Pass value from vb form to crystal Report 9
signature of shakti Dynamic columnwali gives page cannot be opnd error!
Re: Pass value from vb form to crystal Report 9
Quote:
Originally Posted by VBFnewcomer
signature of shakti Dynamic columnwali gives page cannot be opnd error!
Now check it again :wave:
1 Attachment(s)
Re: Pass value from vb form to crystal Report 9
:thumb: Hello shakti Iam not sure I grasped your tutorial for it was assuming certain things, which was lacking in me for eg.
Quote:
5) Create empty formulas for the detail fields. The Design will look something like this...
Row Num Product name {?Month1} {?Month2} {?Month3}{?Month4}........................{?Total}
{rownum} {db.ProdName} {@mon.1-Detail} {@Mon.2-Detail} {@Mon.3-Detail}.............{@Total-Detail}
So I started experimenting (ofcourse borrowing certain things found in your tutorial :D )and discovered the way to create parameter fileds and linking it to the data to be displayed. What I did was I Right clicked on the parameterfields (situate in Field Explorer) and selected NEW, which opnd a dlg box showing param field name, param type. I gave param name as "rgn" and value as "String". Similarly I created a Date type param field named "StartDate". I added both to the Report, which already had the reqd DB fields to display. Now I right clicked on the field (in rpt) which would be affected in response to the values passed to the parameters, and selected , Selection Expert, then the rpt field. Which again opnd another dlg window which had two dropdowns. I selected "is equal to" option and cliked on the second combo to find an entry {?rgn} and cliked OK. I saved the report and added the same to VB6 thru Project->Add Crystal report 9 (in OS Me it would be Project-> More ActiveX designer..->CR9). Now I added the controls & coding found in the attachment. It is working fine. I need you to confirm if what I did was right or is there a better way to do it. secondly, I want the Start Date & End date to be displayed in the report. I used a TextObject in the report and tried to set its value in runtime but I get error "object Reqd". Thirdly, there is a way to load the rpt without using VB .dsr can you provide me the syntax. Also one more thing in one of your posts I found report.SelectionFormula I donot find the option in my vb6.(CR9). Please peruse the files sent by me and guide me. :thumb:
Re: Pass value from vb form to crystal Report 9
I have handled the display of startDate and EndDate in the report. I used the Textfield in the reqd locations and used the SetText property of report in VB6.
VB Code:
'dt1 & dt2 are date variables obtained from DTPs
Report.Text2.SetText (CStr(dt1))
Report.Text3.SetText (dt2)
pls somebody tell me why VBCODE is not working?
Please guide me if Iam on the right track :wave:
1 Attachment(s)
Re: Pass value from vb form to crystal Report 9
sorry forgot to send the projectfiles... attaching it now
Re: Pass value from vb form to crystal Report 9
somebody please guide me :duck: :eek:
Re: Pass value from vb form to crystal Report 9
Have you use the parameter in the crystal report, and pass the value , is it done by you or not??
Re: Pass value from vb form to crystal Report 9
yes. pl see my #6. For the project files see #8