方案1:需要去设置每台电脑的日期格式,在控制面板那里。
方案2:特殊处理一下
Dim d As DateIf Date.TryParse(txt, d) Then msgbox("是日期")Else msgbox("不是日期")End If
If tbl.Cols(Cls(i)).IsNumeric Then '将数值或日期转换为字符 flt = flt & " Convert(" & Cls(i) & ",'System.String') like " & txtElse If tbl.Cols(Cls(i)).IsDate Then flt = flt & cls(i) & " = #" & d & "#"Else flt = flt & Cls(i) & " like " & txtEnd If