'Please open in notepad with maximized window for better results.

----------------------------   Readme For Conditional Reports Demo Project --------------------------


Project Name : Conditional Reports Demo.
No of Forms : 1
Modules: 1
DataReports: 2

Components:
1) Microsoft Forms 2.0 Library
2) Microsoft Windows Common Components 6.0 (1 and 2)
3) Microsoft Hierarchical FlexGrid Control.
4) Microsoft Tabbed Dialog Control

References Required:
1) Microsoft ActiveX Data Objects 2.1 Library.

Controls Used (Additional)
1) Microsoft ListView Control
2) Microsoft forms combo box.
3) Microsoft Hierarchical FlexGrid Control.
4) SSTab Control

This demo project shows how to create data reports which show data based on conditions at the runtime. This is acheived by assigning data to the report in the runtime in form of an ADO recordsets.
It is necessary to remove the DataSource property of all the fields in the report since the datasource will be assigned at the run time.

This project has two Demo Reports:
---------------------------------------------------
1) Orders By Customres : Show Customers, Their Orders and Details for each order listed. This requires a multidimensional recordset will contains command hierarchy of Customers -> Orders -> Details. For doing this the SQL command SHAPE is used which  creates a multidimensional recordset which then can be assigned to the report.

2) Customers List Report: This is a simple report which lists all available customers as selected by the user in the runtime.

Forms Used:
---------------------------------------------------
This demo project uses a single form frmReport, which allows the user to select criteria for the report at the runtime. This forms allows selection criteria for both Orders and Customers report and also shows the hierarchical flex grid with the order data satisfying the user conditions.

The Database:
-------------------------------------------------
This project uses an Access 97 database ReportDB located in the database directory of the project. The database contains four tables:
1) Customers : Stores customer Information (Name, Address, Contact No)
2) Orders : Stores Order information from the customers (Date,CustomerNo,Amount)
3) OrderDetails : Stores detail information for each order (OrderNo,ProductId,Price,Quantity)
4) Products : Stores Product Information (ProductId, Name)

Relationships:
Customers --- One To Many --> Orders
Orders       --- One To Many --> OrderDetails
Products    --- One To Many --> OrderDetails.

The SHAPE SQL Command:
-----------------------------------------
The SHAPE SQL command is very useful in creation of Hierarhical Recordsets for displaying data in controls like Hierarchical Flex Grid and for multilevel Reports like the Orders report in this project.
In order to run this command you must create a connection using the Provider MSDataShape and then opening the recordset using the SHAPE command. The syntax for opening MSDataShape connection is demonstrated in the project by opening the conReport connection to Access Database.
For more information on Data Shaping and SHAPE Command Grammer use MSDN.

Additional functions Used (User Created):
----------------------------------------------------------------------------------------
1) GetRowsOk - Checks whether a recordset contains Data
2) FillCombo - Fills Microsoft Forms Comboboxes with data from specified SQL command.
3) FillList - Fills ListView Control with data specified SQL Command.
4) GetTag - Sepates comma or other character delimited strings into their components.
5) DLookup - Returns a static recordset based on a SQL statement.
6) LookField - Returns a field based on selected SQL statement.
7) DLookupEx - Returns Hierarchical Recordset based on SHAPE statement.
8) ConnectBackend - Establishes connections with Access Database.


I hope this solution solves the queries regarding conditional reporting.
For any information or help fell free to contact me.
-----------------------------------------------------------------------
Regards
Mrugendra
mrugendra999@yahoo.com

-----------------------------------------------------------
Disclamer: This sample is provided As-Is without warrenty of any sorts. The developer or the site hosting can not be held responsible if any damage caused by this sample. The developer has made full attempts to make sure the smooth running of this sample though.