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

Crystal Dies, cannot pass parameter, .parameterfields isn't an option

Status
Not open for further replies.

jenlion

IS-IT--Management
Nov 13, 2001
215
I could really use some help getting my crystal report to run from my VB app. I have two problems:

1. If rept is my crystal report, I have several choices in properties and methods: rept.printreport, rept.sqlstring, etc. I want to pass a parameter to my report, though, and all the examples show rept.ParameterFields(x). I don't have ParameterFields as an option. I'm able to change the SQL string to reflect what I need, but that's not a scalable solution.

Is there some reason I don't have ParameterFields as an option? I get an error if I try to use it anyway (object doesn't support this method).

2. If my report gets too complicated, it will not open. I can say rept.PrintReport, and a Crystal window flashes and closes. Nothing. This happens sometimes when I add fields from tables to my report. I am not prompted to log on; I do have a connection to the SQL server database from the vb program, but the report doesn't ask me to make an OLE or ODBC connection (I've tried both). It just dies. No explanation. I've tried setting rept.UserName and rept.Password, but it doesn't seem to care.

I'm using VB6 sp5 and Crystal Reports 8 Professional. I found that I had to run the crystal reports installation that was included with Visual Studio 6 in order to get the Crystal Reports availablitiy in VB6; I installed to a different location from, but in addition to, my CR8. Crystal 8 doesn't seem to have a problem with that.

If anyone can give me some ideas, I would appreciate it. I've scoured everything, and everyone else seems to have this rept.ParameterFields(x) available. Hmm.
 
CrystalReport1.ParameterFields(0) = "DateDebut ; DateTime (2002,01,28,00,00,00) ;true"

CrystalReport1.ParameterFields(1) = "DateFin ; DateTime (2002,01,28,00,00,00) ;true"

CrystalReport1.ParameterFields(2) = "Usine ; 11 ;true"

---------------------------------------------------------
in fact, values are variables, and it is more like this :

CrystalReport1.ParameterFields(0) = "DateDebut ;" & MyVariable & " ;true"

But, for my trials, I put the values directly .
 
If you want, I send you the entire code by email . This application is suppose to collect variables from a sqlserver table (no problem), and then to launch a .rpt file (already existing) with these variables as parameters, and save the results to a final .rpt file (using the appropriate vb methods, and I managed it ... without the dates parameters) .
 
It looks correct. I am afraid that for me to troubleshoot this question further would require more effort than I can devote to a Tek-Tips thread. You might consider getting an expert to look at the code. There are several experts here (you can tell by looking at our signatures) who are also available for rent. Please make contact outside of TT, since recruiting is not allowed here.
Ken Hamady, On-site Custom Crystal Reports Training & Consulting
Public classes and individual training.
Guide to using Crystal in VB
tek@kenhamady.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top