Results 1 to 11 of 11

Thread: Pass value from vb form to crystal Report 9

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2006
    Location
    India, Punjab, Bhatinda
    Posts
    1,689

    Lightbulb 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 how to use them.

    Thanks in advance.

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: Pass value from vb form to crystal Report 9

    Moved to reporting section

  3. #3
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Thumbs up 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.

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2006
    Location
    India, Punjab, Bhatinda
    Posts
    1,689

    Re: Pass value from vb form to crystal Report 9

    signature of shakti Dynamic columnwali gives page cannot be opnd error!

  5. #5
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Arrow 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

  6. #6

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2006
    Location
    India, Punjab, Bhatinda
    Posts
    1,689

    Lightbulb Re: Pass value from vb form to crystal Report 9

    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 )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.
    Attached Files Attached Files

  7. #7

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2006
    Location
    India, Punjab, Bhatinda
    Posts
    1,689

    Lightbulb 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:
    1. 'dt1 & dt2 are date variables obtained from DTPs
    2. Report.Text2.SetText (CStr(dt1))
    3. Report.Text3.SetText (dt2)
    pls somebody tell me why VBCODE is not working?
    Please guide me if Iam on the right track

  8. #8

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2006
    Location
    India, Punjab, Bhatinda
    Posts
    1,689

    Lightbulb Re: Pass value from vb form to crystal Report 9

    sorry forgot to send the projectfiles... attaching it now
    Attached Files Attached Files

  9. #9

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2006
    Location
    India, Punjab, Bhatinda
    Posts
    1,689

    Lightbulb Re: Pass value from vb form to crystal Report 9

    somebody please guide me

  10. #10
    Just Married shakti5385's Avatar
    Join Date
    Mar 2006
    Location
    Udaipur,Rajasthan(INDIA)
    Posts
    3,747

    Question 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??

  11. #11

    Thread Starter
    Frenzied Member
    Join Date
    Aug 2006
    Location
    India, Punjab, Bhatinda
    Posts
    1,689

    Re: Pass value from vb form to crystal Report 9

    yes. pl see my #6. For the project files see #8

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width