有两个表:表一为项目表,表二为项目通知单表 ,两者关联的字段为pj_ref_id(项目编号),两个表中都有这个字段
 我想在报表中显示
   ENG0001(项目编号)
___________________________________
    PJ0001 (通知单编号) 电梯监控屏(产品名称)DE(产品类别)
    PJ0002                网络通信卡           CE
    PJ0003                考勤与门禁           KQ
我用如下代码怎么有问题,不知错在哪里
con.Provider = "MSDataShape"
strcon = "Provider=MSDataShape.1;Persist Security Info=False;User ID=root;Data Source=TONIC_DB_SERVER"
con.Open strcon
Tmp_sql = "select pj_ref_id from project_ref where pj_ref_id='" & Me.cmbpjrefid & "'"
notic_sql = "Shape {" & Tmp_sql & "} as Project append ({ select pj_ref_id,pj_no,p_name,p_model,p_code,"
notic_sql = notic_sql & "comp_date,job_status_id,mk_name,pj_date from new_project where pj_ref_id='" & Me.cmbpjrefid & "'} as Notic"
notic_sql = notic_sql & " RELATE  pj_ref_id TO pj_ref_id) "
notic_rs.Open notic_sql, con, adOpenDynamic, adLockPessimistic
Set DataReportNotic.DataSource = notic_rs
With DataReportNotic
   .Sections("SecProj").Controls("TxtPjrefid").DataField = notic_rs.Fields(0).Name.Sections("SecNotic").Controls("TxtPjno").DataField = notic_rs.Fields(2).Name
.Sections("SecNotic").Controls("TxtPjno").DataMember = notic_rs.Sections("SecNotic").Controls("TxtPname").DataField = notic_rs.Fields(3).Name
.Sections("SecNotic").Controls("TxtPname").DataMember = notic_rs
.Sections("SecNotic").Controls("TxtPmodel").DataField = notic_rs.Fields(4).Name
.Sections("SecNotic").Controls("TxtPmodel").DataMember = notic_rs
.Sections("SecNotic").Controls("TxtPcode").DataField = notic_rs.Fields(5).Name
.Sections("SecNotic").Controls("TxtPcode").DataMember = notic_rs
.Sections("SecNotic").Controls("TxtCompdate").DataField = notic_rs.Fields(6).Name
.Sections("SecNotic").Controls("TxtCompdate").DataMember = notic_rs
.Sections("SecNotic").Controls("TxtStatus").DataField = notic_rs.Fields(7).Name
.Sections("SecNotic").Controls("TxtStatus").DataMember = notic_rs
.Sections("SecNotic").Controls("TxtMkname").DataField = notic_rs.Fields(8).Name
.Sections("SecNotic").Controls("TxtMkname").DataMember = notic_rs
.Sections("SecNotic").Controls("TxtPjdate").DataField = notic_rs.Fields(9).Name
.Sections("SecNotic").Controls("TxtPjdate").DataMember = notic_rs
End With
DataReportNotic.Show
在分组标头(SecProj)这里放了TxtPjrefid
其它的放在细节中
哪位高手知道的帮助小妹一下,谢谢