is it possible for me to retrieve data from different tables then display them on a single data report. i am using a data environment for connection. if its possible how can i do it

Dani AI

Generated

Yes — you can show data from different tables in a single VB6 Data Report. Typical, reliable approaches are: (A) build one SQL query that joins (or UNIONs) the tables and bind that command in the Data Environment to the report, or (B) use a master/child setup in the Data Environment and place a Subreport for the child rows. provided a packaged example; follow 's unzip tip before opening the project in VB6 so the IDE loads the .vbp and related files correctly.

Recommended quick solution (easiest and most robust): create a single command in the Data Environment with a JOIN that returns every field the report needs, then set the DataReport’s DataSource to the DataEnvironment and DataMember to that command. Example SQL you can paste into a DataEnvironment Command:

SELECT c.CustomerName, o.OrderID, o.OrderDate, od.ProductID, od.Quantity
FROM Customers c
INNER JOIN Orders o ON c.CustomerID = o.CustomerID
INNER JOIN [Order Details] od ON o.OrderID = od.OrderID
ORDER BY c.CustomerName, o.OrderDate

If the data is truly hierarchical (master rows with multiple child rows), use a parent command and a child command (child takes a parameter for the parent key) and add a Subreport control to the DataReport. Bind the Subreport to the child command so each master row renders its child rows within the report. In the VB6 IDE, make sure the Data Report Designer and the ADO/Data components are enabled under Project -> Components; missing components will cause load errors.

Troubleshooting: always extract the downloaded project, open the .vbp in VB6, and check for missing references. If DataReport is unavailable or problematic on modern machines, consider exporting the SQL and using a newer reporting tool or generate a printable layout from code.

Recommended Answers

All 4 Replies

plz check it. If more question plz ask.

im sorry but when i download it and try to open it with VB6 it gives endless lines of unknown code which is not in VB6.how best can i open it..or is there another way to view it

Try to save it onto your drive, unzip it and then open it with vb6. It works fine.

Nice example abu_taher...

thanx man

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.