Data Report - Parameters/Variables

I am trying to make reports using VB6's new Data Report Designer.  All of the examples I have seen (using DRD) have involved binding all data related controls to a command object in a Data Environment Designer.  Furthermore, I have yet to find an example or explanation of how to manually create a report by setting values to labels and textboxes at run-time.
I would like to generate a report using user-provided information (passed variable), NOT data resulting from bound controls.

If the Data Report is unable to fulfill these requirements, is there another Report Designer (no Crystal Reports [agh!], please!) that could?
LVL 1
CArnoldAsked:
Who is Participating?
 
scottschConnect With a Mentor Commented:
The Data Report Designer, IMHO, is not quite a finished product.

A very similar product, that is wonderful, is ActiveReports by DataDynamics. (ActiveReports was awarded VBPJ's Readers' Choice Merit Award at VBITS in San Francisco) It is implimented as an ActiveX Designer.

You can use it and manipulate it just as a form (accessing other forms...), pass it SQL statements, etc.

Unfortunately it has a price tag of $289, but worth every penny in ease of use and flexability...
A must have...

http://www.datadynamics.com/
http://www.vbxtras.com/productmain.asp?ProdID=1876
0
 
AndrewKCommented:
You can affect some aspects of the Data Report at run time - I've altered lables doing this. You have to access them through the collections for the section they are in. I haven't gone into it more than that as I get tired of generating ewrrors due to the fact that MS cannot be bothered to produce decent reference material for this feature!
0
 
CArnoldAuthor Commented:
Eureka!!
I have found the answer to my question!
After toying around with it for a while, I've finally figured out how to manipulate the properties of the Data Report controls!  Here is how:

DataReport1.Sections(3).Controls.Item(1).Caption = "Hi!"

Section(3) = Details section of Data Report.  The Details section of the report is enumerated as "1" when you look at the form in design view.  Disregard how they're numerically indexed in the form's design view.  You will have to find out each section on it's own.  

Item(1) = You will have to know the object's index number to reference it.  Give all objects a unique name (of course) to later identify their index ID (I'll explain later how to do this)

HOW TO DETERMINE SECTION
Create a project consisting of one form and one Data Report.
Insert a varying number of controls into each section of the Data Report (i.e. – Place 1 control in the page header, place 2 in the details section, place 3 in the report header, etc.)
Make a simple form containing a command button and a textbox.  For this explanation, I will be using default control names.  In the click event for the command button, insert the following code:

Private Sub Command1_Click()
Dim x As Integer
x = Val(Text1.Text)
     MsgBox DataReport1.Sections(x).Controls.Count
End Sub

Enter a number in the text box and click the command button.  The number you enter will represent the section you are obtaining a control count.  The returned control count will reflect the number of controls for that section (i.e. – If you placed 3 controls in the Details section and the returned  count value is 3, the number you entered into the textbox is the section index for Details)

HOW TO DETERMINE CONTROL INDEX

Dim x As Integer
Dim y As Integer

    x = DataReport1.Sections(3).Controls.Count
   
    For y = 1 To x
        Debug.Print "Index(" & y & ") = " & _
                DataReport1.Sections(3).Controls.Item(y).Name
    Next y


Substitute “Sections(3)” with the appropriate section number.

0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
anjulicmcCommented:
yuou can pass data to labels by writing a sql at datrareport_initialize containing the data regarding for labels as we do for bound controls.
then do as follow;
datareport.Sections ("<name of section where you want label>").Controls("<label name>").Caption = recordset.coulumns(<column name>).value
0
 
caraf_gCommented:
Hello CArnold,

It looks like your e-mail address er.... "elsewhere"..... is no longer valid. Would you mind sorting that?

Cheers


Pino
0
 
CArnoldAuthor Commented:
Sorry about that Pino.  It has been updated.

Thanks!
CArnold
0
All Courses

From novice to tech pro — start learning today.