Showing posts with label vb6. Show all posts
Showing posts with label vb6. Show all posts

Wednesday, March 28, 2012

Parameter passing CR 10 from VB6

Hi,

I am having problems passing multiple parameters to a CR10 report through VB6 and SQL 2000 sp's.

I think that my vb syntax for passing the parameters is incorrect because:

1. I can call the reports fine within crystal reports
2. The stored procedures return the correct values using parameter passing in Query Analyzer
3. When I set EnableParameterPrompting = True in my VB code the report shows up fine when the parameters are entered through the Crystal parameter dialog box. However, this gives the user free text options to enter what ever they like.

The report accepts four parameters and I get a "Failed to open rowset 22007 - Syntax error converting datetime from character string".

All of my parameter values are set to be strings and this error is not making any sense to me.

Any help would be appreciated.

Thanks,

b1. The ERR in question is related to the Conversion from Date to String variable,
which I presume you have to correct it and store to a variable (strkey1)

Set crystal = New CRAXDRT.Application 'MANAGES REPORTS
Set Report = crystal.OpenReport(a) 'OPEN OUR REPORT - 'a' is the name
of your report with FULL PATH.
Report.DiscardSavedData
Report.Database.SetDataSource rsBldo ' rsBldo is the recordset
containing the Data.
Report.EnableParameterPrompting = False
Report.EnableSelectDistinctRecords = True
Report.EnableGeneratingDataForHiddenObject = False
Report.ParameterFields(j).ClearCurrentValueAndRange

// strkey1 is the variable which holds the above string variable
// Mandatorily you have to create a Parameter Field in CR.

Report.ParameterFields(1).AddCurrentValue (strkey1)

THIS I USES IN CR 9.2 and NOT CR 10, pls try out, hope it should work.

Monday, February 20, 2012

Page number problem when creating reports from VB6

Hi all,

I have a very annoying problem. I use Crystal Reports 8 and I have several reports that are "created" from a VB 6 gui, well they're instansiated and loaded with params from VB. While doing this the reports seem to loose there page numbers. The reports use SP's in a MSSQL 2000 db. This problem does not seem to occur whenever I run the report in design mode but as soon as I try to create them from my VB applications all special fields that has anything to do with page numbers fail. Eg the Page N of M equals Page -1 of 1 which of couse is incorrect.

I've tried with a formula that I saw in a forum somewhere, it was something like:

shared numbervar PageNo;
PageNo := PageNo +1;
PageNo;

and put it in the Page Footer, however I have the same problem here, it works in design mode but not from VB6. Also, doesn't the declaration on the first line reset the variabel each time the formula runs or is it just a redeclaration?

Does anyone have any clues on what I can do? I'm stuck, seems like I've tried everything I can think of. Also, as far as I can see I don't reset the pagenumber after any section, so that shouldn't be an issue either..

Please help me with this one, I've tried searching every forum I've found but haven't come a cross a solution yet!

Regards,

neiden

edit::
I export the reports from VB6 to either a file in .rtf format or print it directlytry using "Global" Instead of "Shared"|||doesn't seem to work either.. now it only displays 1 on each page|||Have another issue as well. I have a database field which is a number with two decimals, whenever I export the report to file or printer from my VB 6 GUI I loose the decimals (replaced by ,00). This is the samething as with page numbers, when I run the report in design mode it shows correct data. I've formatted the field as both 1,00 and System defualt none works..

any ideas on why the reports get messed up whenever I run and export them from VB6?