Dim adoCmd As New ADODB.Command
'根据参数选择报表类型
Select Case sRptType
Case "Pi"
With adoCmd
.ActiveConnection = cCon 'cCon为已做好的连接
.CommandType = adCmdText
'下面是SQL语句
.CommandText = "select *,productQty*productPrice as Total from (((Product"
.CommandText = .CommandText & " as p inner join Details as d "
.CommandText = .CommandText & "on p.productItemId=d.detailsId) inner join Csorder as cs"
.CommandText = .CommandText & " on p.productOrderNo=cs.orderNo) inner join Customer as c"
.CommandText = .CommandText & " on cs.orderCcode=c.customerCode) where productOrderNo='"
.CommandText = .CommandText & sOrdNo & "'"
End With
With crPi
.ubsDate.SetUnboundFieldSource "{ado.orderDate}"
edn with