Duplicated in crystal reports

condor

Member
Joined
Mar 11, 2006
Messages
20
Programming Experience
1-3
I had a problem when i print an invoice in crystal Reports ... The problem : when i search for an invoices by inovice # for example i searched for an invoice # 21 when i wanna to print it's include the prev invoice and it doesnt give me the information about the invoice that i search for it ....

I attaced a pic for the problem...

Thanks fro helping me ...

Regards
 

Attachments

  • Reports.jpg
    Reports.jpg
    68.3 KB · Views: 73
How are you passing the invoice number to the report?
You probably need to clear something when a new invoice is selected.

Does it just keep adding to the report as many times as you search or does it just report on the last 2?
Do you create a new instance of the report when a new invoice is selected?
 
Refresh It

Mr Condor

If this is the problem I feel you should first refresh the report and then select the invoice no & print it. I hope this must solve your problem. I am not an expert . I gave you the solution which I feel is right. Check out if it works.
 
Thanx for ur reply...

Mr. DavidT_macktool i put attached the code ..

also how i can prevent the user from enter more than 20 item's only


regards
 

Attachments

  • Form1.zip
    5.8 KB · Views: 22
The code that i uesed :

Private Sub View_Report()
'=========================================================================
' Pass The Record Selection Formula To The Report Proramatically
' Give You More Flexibility To Play With The Report
' Note The Syntax Of That Formula
' Little Different of SQL
'========================================================================
If Txt_No.Text <> "" Then

Formula = daksf.SelectCommand.CommandText = "SELECT Itemnum ,Glnum,Cat,CostCo,Docnum,Description,Amount FROM kashef where Invoicenum = '" & Txt_No.Text & "' "

End If
'========================================================================
'=========================================================================
' These assrayes used to pass any parameter fields
ReDim Arr_FPF(0) : Arr_FPF(0) = "Afrina Trading & Construction"
'=========================================================================
View_RPT_All("RPT_CustAll.rpt", 1)
'========================================================================
End Sub

Private Sub View_RPT_All(ByVal RD As String, ByVal PapOr As Integer)
' '=========================================================================
' ' This Function help in getting reportd from any where
' ' you will not be worry about the path of the report
' ' just pass this pass to the function
' '=========================================================================
Dim OTable As CrystalDecisions.CrystalReports.Engine.Table
Dim OTableLogInfo As CrystalDecisions.Shared.TableLogOnInfo
Dim RPT As New ReportDocument
Dim I, J As Integer
Dim CON As New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Program Files\Afrina\Afrina\bin\dbaf.mdb;User Id=admin;Password=;")

' '=========================================================================

RPT.Load("..\RPT_CustAll.rpt")
RPT.Refresh()
RPT.PrintOptions.PaperOrientation = PapOr

For Each OTable In RPT.Database.Tables
OTableLogInfo = OTable.LogOnInfo

OTable.ApplyLogOnInfo(OTableLogInfo)
Next OTable
'=========================================================================
' to pass the report parameter fields
'For I = 0 To Arr_FPF.Length - 1 : RPT.SetParameterValue(I, Arr_FPF(I)) : Next
''=========================================================================
'' Pass the selection record formula
If Formula <> "" Then RPT.RecordSelectionFormula = Formula
'=========================================================================
CRViwer.ReportSource = RPT
CRViwer.Zoom(2) ' Fit the report to the page width


'==============================================================
 
Back
Top