I am facing a problem that I have to show database results from 3 different tables on a single report these three tables have are used for different purposes and want to show their headings details separately. I am using VB6 and designing this report in DataReport a common feature for this.
Table1 is for Menu Details
Having following fields: Bill_ID, Menu Type, Cost
Table2 is for Services Details:
Having following fields: Bill_ID, Service Name, Cost
Table3 is for Extra Details:
Having following fields: Bill_ID, Description, Cost
Now structure I want to is like this using common Bill ID, and want to show the headings for each table and then details of each table one by one like this

Bill ID: 1234567890

Menu Details
| Menu Type | Amount |
| Prod1     |    100 |
| Prod2     |     60 |
| Prod3     |     75 |

Service Details
| Service Name | Cost |
| Service1     |   15 |
| Service2     |   17 |

Extra Details
| Description | Cost |
| Extra1      |   11 |
| Extra2      |   12 |
Total Amount: $xxxx

Recommended Answers

All 2 Replies

I assume you can get the results you want in the database with a query and report ?

If so then access the query from VB6 and do what you will with the results.

yes for one table my code is this but its printing the last record only. If i can get a working loop with it i'll be able to do the rest of the things
here is my code

Dim intCtrl As Integer
Dim Counter As Integer
If rs.State = 1 Then rs.Close
    sql = "SELECT * FROM tblHallBServices WHERE servb_bkid='" & LabBID.Caption & "'"
    rs.Open sql, cn
    Counter = rs.RecordCount
    Set drBookBill.DataSource = rs
    drBookBill.Sections("Section2").Controls.Item("Label14").Caption = Counter

'Check if the recordset contain records'
If Not rs.RecordCount = 0 Then
'Move to the first record'
'Loop till the recordset return EOF(end of file)'
   While Not rs.EOF
            drBookBill.Sections("Section2").Controls.Item("Label15").Caption = rs!servb_sname
            drBookBill.Sections("Section2").Controls.Item("Label17").Caption = rs!servb_cost
End If
Be a part of the DaniWeb community

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