什么rong我想要两个表数据选择2条件

时间:2014-03-25 10:18:49

标签: crystal-reports report

我在vb6.0中的项目我想显示带有2个访问表的水晶报告4。我想要第一个字段ID和第二个exam_Date。两个字段均可在两个表中使用。我想从我的代码中传递选择公式。下面是代码 -

Dim Y As Integer, m As Integer, d As Integer

Y = Year(DTPicker1.Value)

m = Month(DTPicker1.Value)

d = Day(DTPicker1.Value)

选择公式:

CrystalReport1.SelectionFormula = "{Master.ID} = '" + Text1.Text + "' and {Master.Exam_Date} =Date(" & Y & "," & m & "," & d & ") and {Path_PatientData.Exam_Date}=Date(" & Y & "," & m & "," & d & ")"

CrystalReport1.PrintReport

但不要显示报告。

1 个答案:

答案 0 :(得分:0)

我只有CR作为独立工具的经验,但通过查看您的代码我想建议一些更改。

  1. 你从可能产生问题的选择公式中的两个表中选择日期,所以不是那样,因为两个表都是链接的,只从一个表中获取日期。
  2. 像这样的东西。

    CrystalReport1.SelectionFormula = "{Master.ID} = '" + Text1.Text + "' and {Master.Exam_Date} >=Date(" & Y & "," & m & "," & d & ") and {Master.Exam_Date} <=Date(" & Y & "," & m & "," & d & ") 
    

    使用,如果它有用的其他丢弃。