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:
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: