PDA

Click to See Complete Forum and Search --> : Help me with Crystal Report....URGENT


preethi_rjs
Feb 20th, 2007, 08:15 AM
hi,

i used the following coding prior to report generation.


d.Execute ("delete from rep_prd")
d.Execute ("delete from rep_others")
d.Execute ("delete from rep_fandr")
d.Execute ("delete from rep_vat")

Set rs1 = d.Execute("select no as invno from inv_mast where no between '" + Text2 + "' and '" + Text3 + "'")

If rs1.EOF Then
MsgBox "No Invoice between the Specified Range", vbOKOnly + vbCritical, "Warning !!"
Text1 = ""
Text2 = ""
Text3 = ""
Text1.SetFocus
Exit Sub
Else

Set rs2 = d.Execute("select * from inv where no between '" + Text2 + "' and '" + Text3 + "' order by line")

Do While Not rs2.EOF

MsgBox rs2!code, , "Code"

If Len(rs2!code) = 8 Then
c1 = Mid(rs2!code, 1, 2)
Set rs4 = d.Execute("select des from glob where no='" + c1 + "'")
If Not rs4.EOF Then
d1 = rs4!des
End If
rs4.Close
c2 = Mid(rs2!code, 3)
Set rs3 = d.Execute("insert into rep_prd values('" + invno + "','" + c1 + "','" + d1 + "','" + c2 + "','" + rs2!des + "','" + rs2!qty + "','" + rs2!Rate + "','" + rs2!amt + "')")
End If

If Len(rs2!code) = 2 And rs2!code <> 95 And rs2!code <> 99 And rs2!code <> 72 Then
c3 = rs2!code
Set rs4 = d.Execute("select des from glob where no='" + c3 + "'")
If Not rs4.EOF Then
d2 = rs4!des + " ON Rs." + rs2!qty + " @ " + rs2!Rate + "%"
End If
rs4.Close
Set rs3 = d.Execute("insert into rep_others values('" + invno + "','" + c3 + "','" + d2 + "'," + rs2!amt + ")")
End If

If Len(rs2!code) = 2 And rs2!code = 72 Then
c3 = rs2!code
Set rs4 = d.Execute("select des from glob where no='" + c3 + "'")
If Not rs4.EOF Then
d2 = rs4!des + " ON Rs." + rs2!qty + " @ " + rs2!Rate + "%"
End If
rs4.Close
Set rs3 = d.Execute("insert into rep_vat values('" + invno + "','" + c3 + "','" + d2 + "'," + rs2!amt + ")")
End If

If Len(rs2!code) = 2 And rs2!code = 95 Or rs2!code = 99 Then
c3 = rs2!code
Set rs4 = d.Execute("select des from glob where no='" + c3 + "'")
If Not rs4.EOF Then
d2 = rs4!des
End If
rs4.Close
Set rs3 = d.Execute("insert into rep_fandr values('" + invno + "','" + c3 + "','" + d2 + "'," + rs2!amt + ")")
End If

rs2.MoveNext
Loop
End If
'Else
'MsgBox "No Products Sold"
'End If 'rs2 close
'End If 'rs1 close

inv.ReportFileName = App.Path & "\inv.rpt"
inv.WindowState = crptMaximized
inv.DiscardSavedData = 1
inv.Action = 1


there is no error in adding to the corresponding table.
but while generating reports, i face some problems :

1) invno is always retrieved as blank with no values stored in it.

2)Now as i am giving both values Text2 and Text3 same, i am able to get the product list correctly. bt when i giv a range of values, hw shud i change the looping structure so that for each invoice(that i get thru range), i get reports separetly.

3)in the table rep_others and rep_fandr, i will hav multiple fields. while adding to the table i hav added correctly, bt while displaying iam able to view only 1 row. y is it so? [NOTE:For rep_prd table i hav include subtotal field. so im unable to include it in the "Details" part.

plz help me solve this................... :ehh:

Hack
Feb 20th, 2007, 08:21 AM
First off, you are concantenating, not adding values, so you need to change the + signs to & signs.

preethi_rjs
Feb 20th, 2007, 08:36 AM
Thanx Hack for ur quick reply..............hav changd it.

as i need some codes to be under the head "ADD" and others under "LESS" im making these table insertions and then generating reports.

Hack
Feb 20th, 2007, 08:40 AM
Did changing to the proper method of concantenation help with any of your other issues?

preethi_rjs
Feb 20th, 2007, 09:01 AM
i got the value for invno. i dint specify recordset name.

then,i am able to save correctly to tables. bt while generating Reports i hav doubts.

when displaying frm rep_mast, as there will b multiple columns, i kept those in "Details". Also,for the rep_mast i ll hav SubTotal for Value column.

in the same report i hav to display contents of other 3 tables also.

Of the remaining tables, rep_fandr and rep_others i'll hav multiple rows. its added to the table correctly. bt while displaying in the report i dont get all.only 1 is being viewed. y is it so?

only the fields that are in the "Details" can hav multilple rows???

bt. i need SubTotal for Value Column of rep_prd.

aftr the Subtotal only other table contents shud b viewed.

preethi_rjs
Feb 20th, 2007, 11:23 PM
rep_prd --> List of prod.names, so given in Details Part.
rep_fandr + rep_others---> Details regarding Discount, Freight, etc.,

After having List of Product's total only, i need these other details to be displayed.

If rep_fandr and rep_others hav single row in its table i'm able to view. but if it has more rows, only the last row gets viewed.

hw shud i make all the rows to be viewed????

plzzzzzzzzzz help me solve this. its really very urgent. :o