求教高手[Microsoft][ODBC Microsoft Access Driver] 标准表达式中数据类型不匹配。
我的目的是根据文本框中输入,从数据库中查帐."出生年月"是文本型,如1985-05-05
当注销 ' On Error Resume Next 不会出现错误提示,但查询出的数据有很多重复;
不注销缺出现以上提示,敬请指教
Select Case Combo5.ListIndex
Case 0
strSQL = "Select * from hmc where (" & Date * 1 & " - " & "DateValue(出生年月) * 1) > " & (val(Text7.Text)) * 365
Case 1
strSQL = "Select * from hmc where (" & Date * 1 & " - " & "DateValue(出生年月) * 1) < " & (Val(Text7.Text)) * 365
End Select
If Rs.State = adStateOpen Then Rs.Close
Rs.Open strSQL, Cn, adOpenStatic, adLockReadOnly, adCmdText
MSFlexGrid1.Rows = 1
Dim lngRw As integer '初始行
lngRw = 1
MSFlexGrid1.Redraw = False
MSFlexGrid1.Clear
' On Error Resume Next
Do Until Rs.EOF
MSFlexGrid1.AddItem ""
MSFlexGrid1.Row = lngRw
For i = 0 To Rs.Fields.Count - 1
MSFlexGrid1.Col = i
MSFlexGrid1.TextMatrix(lngRw, i) = IIf(IsNull(Rs(i)), "------", Rs(i))
Next i
Rs.MoveNext'错误提示就指向这里
lngRw = lngRw + 1
Loop
MSFlexGrid1.Redraw = True
Rs.Requery
Rs.Close