Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VB & Crystal paramater prompt problem

Status
Not open for further replies.

rotomd

IS-IT--Management
Nov 1, 2004
11
US
I'm trying to pass variable from visual basic over to a crystal report parameter and that works fine, unfortunetly as soon as the report loads I am prompted to enter the variable again in the "Enter parameter fields" box. Is there anyway I can disable the parameter field box?

I am using crystl32.ocx component to call the report, bellow is my code:

Private Sub Command2_Click()
Dim test
test = InputBox("GRRR")
CrystalReport1.ReportFileName = "temp.rpt"
With CrystalReport1
.DiscardSavedData = True
.ParameterFields(0) = "par;" & test
.Action = 1
End With
End Sub
 
You need to pass a third argument in order to keep the prompt from displaying:

.ParameterFields(0) = "par;" & test & ";true"

-dave
 
I tried both true and false as a third argument and the prompt is still displaying.
 
Hmmm... any subreports? What's the datatype of 'par'?

-dave
 
no subreports. par is a string. it's odd when i use

.ParameterFields(0) = "par;" & test & ";true"

it doesn't even show my entered text in the crystal parameter box, but when I use

.ParameterFields(0) = "par;" & test & ";false"

it does show my entered text in the parameter prompt box. I'm not sure if this helps or not. I haven't been able to find much documentation on crystal32.ocx. Do I possibly need any other components to accompy this?
 
Hmm, moving the .discardsavedData didn't change my program...
 
try the following
Code:
Private Sub Command2_Click()
    Dim test [COLOR=blue] as string[/color]
' not strictly required but good practice to type variables
    test = InputBox("GRRR")
    CrystalReport1.ReportFileName = "temp.rpt"
    With CrystalReport1
[COLOR=BLUE]         .EnableParameterPrompting = False[/color]
        .DiscardSavedData = True   
        .ParameterFields(0) = "par;" & test
        .Action = 1
    End With
End Sub

Take Care

Matt
If at first you don't succeed, skydiving is not for you.
 
when I try .EnableParameterPrompting = False there is an error that it can not find the method. Is it possibly that I'm missing a .dll file? when I run depends.exe on the file I recieve this list:

CRPE32.DLL
OLEPRO32.DLL
VERSION.DLL
KERNEL32.DLL
USER32.DLL
OLE32.DLL
ADVAPI32.DLL
OLEAUT32.DLL
COMDLG32.DLL
GDI32.DLL
 
OK, I have found the solution! DiscardSavedData must be set to false and then it will not prompt you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top