时间大小的比较
“2005/11/1”和2005/12/12 12:12:12
这两种日期可以在access中比较大小吗?
我这里有个通用过程
Private Sub AccessData(ByVal tableVar As String, ByVal FieldVar As String, ByVal var1 As String, ByVal var2 As String)
Dim strSQLcheck As String
Set connHope = New ADODB.Connection
Set rsHope = New ADODB.Recordset
If var2 = "" Then
Select Case Combo2.Text
Case "销售单价", "进货价", "货存量", "最近入货日期", "销售额", "出售时间", "进货量", "进货日期", "销售数量"
strSQLcheck = "select * from " & tableVar & " where " & FieldVar & " =" & var1
Case Else
strSQLcheck = "select * from " & tableVar & " where " & FieldVar & " ='" & var1 & "'"
End Select
Else
strSQLcheck = "select * from " & tableVar & " where " & FieldVar & " >= " & CDate(var1) & " and " & FieldVar & " <= " & CDate(var2)
End If
' MsgBox strSQLcheck 'passed 这里调试通过了
connHope.CursorLocation = adUseClient
Call PubConnSub(connHope, rsHope, strSQLcheck, 1, 1)
' MsgBox "have connected databse" 'passed
If rsHope.EOF = True Then
rsHope.Close
Set rsHope = Nothing
connHope.Close
Set connHope = Nothing
MsgBox "没相关记录!"
Else
DataGrid1.Caption = "共查询到" & CStr(rsHope.RecordCount) & " 条符合条件的记录"
Set DataGrid1.DataSource = rsHope
DataGrid1.Refresh
End If
End Sub
参数都传递过来了,但是却执行了rsHope.EOF = True的那部分代码