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 biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Parameter Data Types

Status
Not open for further replies.
Dec 5, 2001
82
GB
Crystal 8.5, Oracle 7.3, RDC, odbc connection.

VB form with a number of textboxes, after the report is selected each parameter name in the report is assigned to a text box on the form, so the user can see what that text box is for. The user puts in the information required and then it loops the entry back to the specific parameter. How though do I get it to know what data type the report parameter is, so that I can ensure that what is put in the text box is the correct data type?
 
You can use the ParameterFields collection and the ValueType property to get the parameter's datatype. Like this:
Code:
For i = 1 To Report.ParameterFields.Count
    MsgBox Report.ParameterFields(i).ValueType
Next i
And here are the possible ValueType values:

crBitmapField 17
crBlobField 15
crBooleanField 9
crChartField 21
crCurrencyField 8
crDateField 10
crDateTimeField 16
crIconField 18
crInt16sField 3
crInt16uField 4
crInt32sField 5
crInt32uField 6
crInt8sField 1
crInt8uField 2
crNumberField 7
crOleField 20
crPersistentMemoField 14
crPictureField 19
crStringField 12
crTimeField 11
crTransientMemoField 13
crUnknownField 2

-dave
 
Vidru,

Thanks for the response. I was just looking at that and was doing this:

For I = 1 To crRpt.ParameterFields.Count
Set crParm = crRpt.ParameterFields(I)
strClientID = frmUI.Controls("txtClient" & I).Text
crvaltype = crParm.ValueType
crParm.SetCurrentValue strClientID, crvaltype
Next I

I did have the strClientID and the crvaltype dimmed as string and then I then removed the as string part, so that they would be picku up as a variant(?).

However whenever I use this code it works fine for the first parameter (which is a string), but when the second parameter is not a string (I've tried, numbers and dates) it falls over, but if I change the 2nd parameter to also look at a string field it works, even though I've using the parameter valuetype property to set the current value when I put it back in.

Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top