×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

Business Objects: Crystal Reports 3 Integrate FAQ

Crystal and VB

How do I pass a string parameter to Crystal from a VB text box? by mdctsg
Posted: 13 Dec 03 (Edited 15 Dec 03)

If you are familar with Crystal Reports then skip to Part 2

Part 1

Create your report in Crystal. Insert your parameter. If you are not familar with it go to Insert, select Field Object. Then select Parameter Fields. Next select the new button (Which looks like a page with a yellow star). Give your parameter a name and make sure the value type is String. Then select OK. Then drag the parameter into your report and select close. Next, right click on the parameter and choose Select Expert. If this is your only parameter select the field your parameter will represent. Then select OK. Next in the combo drop down menu select "is equal to". The in the other combo box that appears select your parameter, then ok. That will prompt you for the parameter the next time you refresh

Part 2

On your form place the Crystal Reports Control, a Text Box and a Command Button
Name the Report Control to CR1 or whatever you want.

The same for the textbox.
In your Command Button Code

Private Sub Command1_Click()

With CR1
 .ReportFileName = App.Path & "\Your Report.rpt
 .ParameterFields(0) = "Your Crystal Parameter Name;" & Your Text Box Name & ";TRUE;"
 .Destination = crptToWindow
 .Action = 1
 .PageZoom (100)

End With
End Sub


Adding the TRUE to the statement stops the Crystal prompt from appearing allowing you to use your text box as the parameter.
I made the mistake of declaring the textbox do don't do that. Don't put the ? that is attached to your parameter in crystal

I hope this will help someone with the same problem. I have seen this question many times.

Back to Business Objects: Crystal Reports 3 Integrate FAQ Index
Back to Business Objects: Crystal Reports 3 Integrate Forum

My Archive

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close