PDA

Click to See Complete Forum and Search --> : multiple reports CR9 viewer


engnouna
Aug 7th, 2006, 06:45 AM
Hi
I have a CR9 viewer inside my VB6 form ,the back end is Access 2003.
I am using the following SQL to view a report corresponding to BID=24(it's the primary key)

SQL="SELECT Btest.*, BOrigin.*, BDestination.*, Btest.BID"
SQL= SQL & " FROM (Btest INNER JOIN BOrigin ON Btest.BOriginID = BOrigin.BOriginID) INNER JOIN BDestination"
SQL=SQL & " ON Btest.BDestinationID = BDestination.BDestinationID WHERE (((Btest.BID)=24))"


rs6.Open SQL, cn, adOpenKeyset, adLockPessimistic

Set oApp = New CRAXDRT.Application
Set oReport = oApp.OpenReport(App.Path & "\Report3.rpt", 1)
oReport.Database.SetDataSource rs6, 3, 1
frmreport.crvMyCRViewer.ReportSource = oReport
frmreport.crvMyCRViewer.ViewReport
frmreport.crvMyCRViewer.Refresh
frmreport.Show 1
rs6.Close

But the report instead of giving me the report corresponding to 24(the ID of the record),returns to me 63 reports.
I tried the SQl query in my Database access(I run the query corresponding to SQL) and it returned to me a single record(the correct answer)
What's wrong?
Please help me it's very urgent
thanks

mabbas110
Aug 10th, 2006, 03:18 AM
ok u put the following code in it also

CRV.SelectionFormula = "{BTEST.BID}=24"

i hope this will solve ur problem

engnouna
Aug 10th, 2006, 03:23 AM
thanks mabbas