1

我的记录集已成功填充 ADO。但是现在如何将它与vb6中的数据报告的文本字段连接起来?请帮忙?我的查询如下..

   str = "SHAPE {select * from sale where sale_from_id='" & firmName &
         "' and ret_id='" & Trim(txtRetId) & "' and date >=#" &
       Format(dtpFrom.value, "MM-DD-YYYY") & "# and date <= #" &
       Format(dtpTo.value, "MM-DD-YYYY") & "#}" _
                   & " APPEND ((SHAPE {select  sd.sale_id,sd.sdet_id,sd.item_id,i.item_name,sd.qty,sd.sdet_price,sd.sub_total
       from sale_detail sd, item i where i.item_id = sd.item_id}" _
                          & " APPEND({select * from sale_serial} AS sale_serial" _
                                  & " RELATE sdet_id TO sdet_id )) AS sale_detail" _
                         & " RELATE sale_id TO sale_id ) AS sale"
4

2 回答 2

2

把这段代码写在这里我把我的代码

       InvSql = "   SHAPE {SELECT * FROM `sales`}  AS salesgroup COMPUTE  salesgroup,   COUNT(salesgroup.'units') AS Aggregate1, <br/>SUM(salesgroup.'price') AS    Aggregate2, SUM(salesgroup.'total') AS Aggregate3 BY 'mname'" 


Set invReport = New ADODB.Recordset
 invReport.Open InvSql, cn
    invReport.Requery
Set rssum = New ADODB.Recordset
sumSql = "select amount  from credit where billno='BL001'"
rssum.Open sumSql, cn
rssum.Requery
 rptdealer.Sections("Section5").Controls.Item("Label5").Caption = "Rs." & rssum(0).Value
    Set rptdealer.DataSource = invReport
rptdealer.Show

 goto report page and insert group footer and group header place ur texbox and lables
get into code behind page of report page 

Private Sub DataReport_Initialize()
On Error Resume Next
   Move 0, 0
   Me.Caption = "Invoice Report"
   Me.Width = 11600
   Me.Height = 9000
   Me.ReportWidth = 8520
   Me.BottomMargin = 1440
   Me.TopMargin = 1440
   Me.LeftMargin = 1440
   Me.RightMargin = 1440
  SetSection6
End Sub
Private Sub SetSection6() 'parent credit
  Sections("Section6").Controls("txtbillno").DataField = "mname"
End Sub

 for other controls place controls and in datafield five the column name in database 
<strong>thats it now run !!!</strong>
于 2013-09-09T09:01:45.207 回答
0
Private Sub SetSection6()  'parent sales => Group header
Sections("Section1").Controls("text1").DataField = "firmName"
End Sub
于 2013-09-02T11:35:10.533 回答