怎么没人理我啊?
再问一个:
查询语句(Vb->access)中如果字段是日期类型的,语句该怎么写啊?
sql="select * from a where [datein]='" & text1.text & "'"对吗?

解决方案 »

  1.   

    DataReport1.Sections("section3").Controls("rptFunction3").Value=DataReport1.Sections("section3").Controls("rptFunction1").Value + DataReport1.Sections("section3").Controls("rptFunction2").Value
    到底是section几你自己测试并修改吧。
      

  2.   

    up!
    至于第二个问题,我来回答!
    sql="select * from Table 
    Where
      (DataField=CONVERT(DATETIME, '" & text1.text & "', 102))"
      

  3.   

    以上SQL语句如果用来查询ACCESS数据库就不行了,要在日期字段前后加 #
      

  4.   

    sql="select * from a where [datein]='" & text1.text & "'"对吗?
    应该是sql="select * from a where [datein]=#" & text1.text & "#"才对
      

  5.   

    zhaolinyu2001(风中浪子) :
    {up}虽然我不知道什么什么意识
    但我看别人写了
    感觉很有意识能告诉我吗
    ------------------------------------------------
    up在这里本来可以翻译成将帖子提前的,可是现在只有斑竹和楼主能提前了。
    现在可以理解为顶,或者就是说关注,代表你来过的样子。~~~~~~~~~~
      

  6.   

    13161795500(活着真累) ( ) :
    不行啊,报错:error 438,对象不支持这种属性或方法
      

  7.   

    不用 Function 用 Label,在程序中计算,算完了赋值。
      

  8.   

    报表的我还没试,但13161795500(活着真累)的方法我看没什么问题啊,可能是属性错了而已,方法是这样没错。
    另外SQL语句查询日期时还需注意,若日期可以为空的话,那text1.text可能为空串,那么SQL语句写成sql="select * from a where [datein]=#" & text1.text & "#"时将出错,应该写加一判断下去:
    if text1.text<>"" then
    sql="select * from a where [datein]=#" & text1.text & "#"
    else
    sql="select * from a where [datein]=null"
    end if
      

  9.   

    rptFunction好象没有类似value,text等属性啊?怎么办?没办法得到它们的值吗?
      

  10.   

    同意: CloneCenter(复制中心) 用rptLabel代替,先在程序中算出来
    Set cn = New ADODB.Connection
        
        cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\db1.mdb;Persist Security Info=False"
        cn.Open
        cn.CursorLocation = adUseClient
        
        Set rs = cn.Execute("select sum(field1),sum(field2) from table1 where ...")
        Total = rs(0) + rs(1)
        rs.Close
        cn.Close
        Set rs = Nothing
        Set cn = Nothing 
     rptCar.Sections("rptRFooter").Controls("lblTotal").Caption = Total