我的记录集已使用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"
在此处以表单形式编写此代码,并放置代码
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>
Private Sub SetSection6() 'parent sales => Group header
Sections("Section1").Controls("text1").DataField = "firmName"
End Sub