?
Solved

Data Report - Parameters/Variables

Posted on 1999-07-26
6
Medium Priority
?
231 Views
Last Modified: 2010-04-30
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?
0
Comment
Question by:CArnold
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
6 Comments
 
LVL 2

Expert Comment

by:AndrewK
ID: 1527578
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
 

Accepted Solution

by:
scottsch earned 100 total points
ID: 1527579
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
 
LVL 1

Author Comment

by:CArnold
ID: 1527580
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
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Expert Comment

by:anjulicmc
ID: 2765257
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
 
LVL 10

Expert Comment

by:caraf_g
ID: 6799810
Hello CArnold,

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

Cheers


Pino
0
 
LVL 1

Author Comment

by:CArnold
ID: 6801136
Sorry about that Pino.  It has been updated.

Thanks!
CArnold
0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Suggested Courses

719 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question