首页上一页 1 下一页尾页 1 条记录 1/1页
如何实现报表数据来源于同一数据库的两个表
发表在VB答疑区
2008-04-17
是否精华
是
否
版块置顶:
是
否
<P><FONT color=#ff3300><FONT color=#110300>Private Sub Command1_Click()'打印按钮<BR> Set DataReport2.DataSource = AdoEmpDetail.recordset<BR> DataReport2.Sections("Command2_Detail").Controls("txt出入证号").DataField = "BadgeID"<BR> DataReport2.Sections("Command2_Detail").Controls("txt姓名").DataField = "EmpName"<BR> DataReport2.Sections("Command2_Detail").Controls("txt性别").DataField = "Sex"<BR> DataReport2.Sections("Command2_Detail").Controls("txt出生日期").DataField = "Birth"<BR> DataReport2.Sections("Command2_Detail").Controls("txt常住地址").DataField = "Files_Keep_Org"<BR> DataReport2.Sections("Command2_Detail").Controls("txt暂住地址").DataField = "Hukou"<BR> DataReport2.Sections("Command2_Detail").Controls("txt婚姻状况").DataField = "Marital_Condition"<BR> DataReport2.Sections("Command2_Detail").Controls("txt到岗日期").DataField = "HireDate"<BR> DataReport2.Sections("Command2_Detail").Controls("txt填表日期").DataField = "Fillin_Time"<BR></FONT> DataReport2.Sections("Command2_Detail").Controls("txt所属分厂").DataField = select depname from departments where depid = "depid"</FONT></P>
<P><FONT color=#ff3300> </FONT><FONT color=#000000>DataReport2.Sections("Command2_Detail").Controls("txt工作岗位").DataField = "Position1"<BR> DataReport2.Sections("Command2_Detail").Controls("txt身份证号").DataField = "Id_Card"<BR> DataReport2.Sections("Command2_Detail").Controls("txt备注").DataField = "Memo1"<BR> kill "temppic\mypicture.bmp"<BR> If FrmEmpMan.Image1.Picture <> 0 Then<BR> SavePicture FrmEmpMan.Image1.Picture, "temppic\mypicture.bmp"<BR> End If<BR> DataReport2.Show<BR> Const cf_bitmap = 2<BR> Dim msg<BR> On Error Resume Next<BR> Clipboard.Clear<BR> Clipboard.SetData LoadPicture("temppic\mypicture.bmp")<BR> If Err Then<BR> msg = "没有找到照片"<BR> MsgBox msg<BR> Exit Sub<BR> End If<BR> Set DataReport2.Sections("Command2_Detail").Controls("image1").Picture = Clipboard.GetData()<BR> DataReport2.Sections("Command2_Detail").Controls("image1").Picture = LoadPicture()<BR>End Sub<BR></FONT></P>
<P><FONT color=#ff3300> </FONT><FONT color=#000000>DataReport2.Sections("Command2_Detail").Controls("txt工作岗位").DataField = "Position1"<BR> DataReport2.Sections("Command2_Detail").Controls("txt身份证号").DataField = "Id_Card"<BR> DataReport2.Sections("Command2_Detail").Controls("txt备注").DataField = "Memo1"<BR> kill "temppic\mypicture.bmp"<BR> If FrmEmpMan.Image1.Picture <> 0 Then<BR> SavePicture FrmEmpMan.Image1.Picture, "temppic\mypicture.bmp"<BR> End If<BR> DataReport2.Show<BR> Const cf_bitmap = 2<BR> Dim msg<BR> On Error Resume Next<BR> Clipboard.Clear<BR> Clipboard.SetData LoadPicture("temppic\mypicture.bmp")<BR> If Err Then<BR> msg = "没有找到照片"<BR> MsgBox msg<BR> Exit Sub<BR> End If<BR> Set DataReport2.Sections("Command2_Detail").Controls("image1").Picture = Clipboard.GetData()<BR> DataReport2.Sections("Command2_Detail").Controls("image1").Picture = LoadPicture()<BR>End Sub<BR></FONT></P>