Click to See Complete Forum and Search --> : Pass value from vb form to crystal Report 9
VBFnewcomer
Nov 10th, 2006, 12:06 AM
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:
Hack
Nov 10th, 2006, 06:01 AM
Moved to reporting section
shakti5385
Nov 10th, 2006, 07:00 AM
You can use parameter for this type of purpose, Read how to add dynamic column In the CR at my Signature. :wave:
VBFnewcomer
Nov 11th, 2006, 12:41 AM
signature of shakti Dynamic columnwali gives page cannot be opnd error!
shakti5385
Nov 11th, 2006, 03:04 AM
signature of shakti Dynamic columnwali gives page cannot be opnd error!
Now check it again :wave:
VBFnewcomer
Nov 13th, 2006, 12:05 AM
:thumb: Hello shakti Iam not sure I grasped your tutorial for it was assuming certain things, which was lacking in me for eg.
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:
VBFnewcomer
Nov 13th, 2006, 11:38 PM
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.
'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:
VBFnewcomer
Nov 13th, 2006, 11:40 PM
sorry forgot to send the projectfiles... attaching it now
VBFnewcomer
Nov 15th, 2006, 12:00 AM
somebody please guide me :duck: :eek:
shakti5385
Nov 15th, 2006, 12:43 AM
Have you use the parameter in the crystal report, and pass the value , is it done by you or not??
VBFnewcomer
Nov 20th, 2006, 05:25 AM
yes. pl see my #6. For the project files see #8
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.