Problem when linking 3 tables

tdk007

Member
Joined
Aug 8, 2005
Messages
5
Programming Experience
5-10
Hi, my problem is that when I try to print the report, it print 3 times the same thing.

Here's the descritpion of my tables.

Table 1 is the generic info of a Job ( Docket(Key), Client, Numeric Sequence ...) - 1 Record
Table 2 is the detail info from the job ( Docket(Key), Control Number From, Control Number To...) - 3 Records
Table 3 is the missing control ( Docket(Key), Controle Number From, Control Number To) - 1 Record

Here's my code to print the report

Dim strConnection As String = "Data Source=gra002000;user id=sam;password=herewego;initial catalog=SSECURITE;Provider=SQLOLEDB;"
Dim Connection As New OleDbConnection(strConnection)
Dim strSQL As String = _
"SELECT DISTINCT AssembInfo.NomClient, AssembInfo.NoClient, AssembInfo.NoFormulaire, AssembInfo.NoDossier, AssembInfo.NoCopie, AssembInfo.QtéCommClient" _
& ", AssembInfo.SeqClientDe, AssembInfo.SeqClientA, AssembInfo.NoDosSec, AssembContSeq.NoContBonDeb, AssembContSeq.NoContBonFin, AssembContSeq.NoSeqBonDeb, AssembEch.NoContDeb, AssembEch.NoContFin," _
& " AssembContSeq.NoSeqBonFin, AssembContSeq.QteBonCont, AssembContSeq.NoContDetDeb, AssembContSeq.NoContDetFin, AssembContSeq.QteDetCont, AssembContSeq.IDNo" _
& " FROM AssembInfo FULL OUTER JOIN AssembContSeq ON (AssembInfo.NoDosSec=AssembContSeq.NoDosSec) AND (AssembInfo.NoDossier=AssembContSeq.NoDossier) FULL OUTER JOIN AssembEch ON (AssembInfo.NoDosSec=AssembEch.NoDosSec) AND (AssembInfo.NoDossier=AssembEch.NoDossier)" _
& " WHERE AssembInfo.NoDossier='" &
Me.txtDocket.Text & "' and AssembInfo.NoDosSec='" & Me.lstSecDos.Text & "'" _
& " ORDER BY AssembInfo.NoDossier, AssembInfo.NoDosSec, AssembContSeq.IDNo"
Dim DA As New OleDbDataAdapter(strSQL, Connection)
Dim DS As New DataSet
DA.Fill(DS, "AssembInfo")
Dim strReportPath As String = Application.StartupPath & "\Assemblage.rpt"
Dim cr As New Assemblage
cr.Load(strReportPath)
cr.SetDataSource(DS.Tables("AssembInfo"))
cr.PrintOptions.PrinterName = "\\grasrvr01\xeroxn40"
cr.PrintToPrinter(1,
False, 0, 0)

In my report I got the info from Table1 in the Page Header, the info from Table2 in the Detail section and the info from Table3 in a subreport in the report footer.

But when I try to print the report it print for exemple 1 time the header but 3 time the Table2 info and Table3 info like:

Docket: S-1111111 Client: Royale Bank ...

Detail

Cont Start Cont End
123 456
789 012
567 454

123 456
789 012
567 454

123 456
789 012
567 454

Missing Cont

Cont Start Cont End
111 222
111 222
111 222

Can someone help me? Maybe it's my JOIN with the table.
 
Back
Top