1.如何检测text1.tex是日期格式如"2005-1-12"  
  该怎么写?
  if text1.text格式"#!@#" then    do@#$#@$#@还有, 我ACCESS数据库表1的date列格式是短日期,我在text1 中输入2005-12-12查记录竟然报错!

解决方案 »

  1.   

    text1的FORMAT属性改了,但报错啊 !
    如何转换?具体点出没碰到过
      

  2.   

    http://search.csdn.net/Expert/topic/1747/1747109.xml?temp=.525036
      

  3.   

    1,检查是否为日期型数据:
    private sub text1_lostfocus()
        if text1.text<>"" then
            if not isdate(text1.text) then
                msgbox "请输入日期型数据!",48,"提示"
                text1.setfocus
                exit sub
            else
                text1.text=format(text1.text,"YYYY-MM-DD")
            end if
        end if
    end sub2,根据日期查询数据:
      '数据库为ACCESS的写法:
      strsql=" select * from tablename where 日期字段=# " & text1.text & " # "
      '数据库为SQL的写法:
      strsql=" select * from tablename where 日期字段='"& text1.text &"'"