怎样吧STRING类型的数据转换成形如“2000-12-25”的DATE日期型数据呢
具体来说:有三个TEXTBOX,对应为text3.text:年;text4.text:月;text5.text:日
怎样把输入的数据转换成如上所说的日期型数据呢?谢谢

解决方案 »

  1.   

    Private Sub Command1_Click()
    Dim d As Date
    d = CDate(Text1.Text & "/" & Text2.Text & "/" & Text3.Text)
    Debug.Print d
    End Sub
      

  2.   

    接楼上的Private Sub Command1_Click()Dim d As Dated = CDate(Text1.Text & "/" & Text2.Text & "/" & Text3.Text)Debug.Print format$(d,"yyyy-mm-dd")End Sub
      

  3.   

    那么adodc1.RecordSource = "select * from 储户存取帐 where 时间>'" + d + "'"
    为什么报错:type mismatch呢?谢谢
      

  4.   

    你是用在什么数据库里?你那是在sql server里的查询方式,在access里是:
    adodc1.RecordSource = "select * from 储户存取帐 where 时间>#" + d + "#"