How do i generate one data report fom multple tables.I have four tables each with a primary key.I require a master report for this data in this tables.Anyone know how to do it?Am using vb6 and access.Thanx


If you go into access an create the report you want based on a query. Then call query/report from VB6.


hi lasherz2,

first is you'll make a query in your access,select the tables you want to create and put all their fields that you are needed.

In your VB make a query command that joins the table

On Error Resume Next
Dim qryDef As QueryDef
Dim de As New Dev
Dim str As String

Set qryDef = dbase.QueryDefs("TABLE1Query")

If Err.Number = 3265 Then
Set qryDef = dbase.CreateQueryDef("TABLE1Query")
End If

str = "select TABLE1.Id,TABLE2.Id from [TABLE1] LEFT JOIN TABLE1.Id on TABLE2.Id where TABLE1.Id=TABLE2.Id "

qryDef.SQL = str

Set de = New DetaEnvironment1
Set StickerReport.DataSource = de
StickerReport.DataMember = "Query Command"

StickerReport.Show 1

Err = 0
Set de = Nothing
Unload Dev

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.