查询中实现分组打印!急!!!
Private Sub Cmdprint_Click()Set cnn = New ADODB.Connection
cnn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=入库管理.mdb;Persist Security Info=False"
cnn.Open
If Check1.Value = 0 And Check2.Value = 0 Then
DR1.Show
End If
If Check1.Value = 0 And Check2.Value = 1 Then
DataEnvironment1.rsCommand1_分组.Open "select 供应商名称,入库单编码,入库时间,入库类别,进价,实付价格,折扣,入库性质 from 入库单 where 入库单编码 >= '" & Trim(Combo1.Text) & " 'and 入库单编码<='" & Trim(Combo2.Text) & "' ", cnn, adOpenKeyset, adLockOptimistic
DR2.Show
End If
If Check1.Value = 1 And Check2.Value = 1 Then
DataEnvironment1.rsCommand1_分组.Open "select 供应商名称,入库单编码,入库时间,入库类别,进价,实付价格,折扣,入库性质 from 入库单 where 入库单编码 >= '" & Trim(Combo1.Text) & " 'and 入库单编码<='" & Trim(Combo2.Text) & "' And 入库时间 >=#" & Format(DTPicker1.Value, "yyyy-mm-dd") & " #and 入库时间 <=# " & Format(DTPicker2.Value, "yyyy-mm-dd") & "# order by 入库单编码"
DR2.Show
End If
If Check1.Value = 1 And Check2.Value = 0 Then
DataEnvironment1.rsCommand1_分组.Open "select 供应商名称,入库单编码,入库时间,入库类别,进价,实付价格,折扣,入库性质 from 入库单 where 入库时间 >=#" & Format(DTPicker1.Value, "yyyy-mm-dd") & " #and 入库时间 <=# " & Format(DTPicker2.Value, "yyyy-mm-dd") & "# order by 入库单编码", cnn, adOpenKeyset, adLockOptimistic
DR2.Show
End If
End Sub
[img=http://fmn005.][/img]
选择复选框后查询并打印,报表无法实现按供应商名称分组打印。如何解决?