数据库查询问题。在线等!
我做了一段查询程序,现在想加入时间查询,不知道怎么加,请高手赐教,我用的 是framel,我在里面加入时间文本框,入年,月,日。然后在里面写入我想查询的时间,同时
三个合同号and班组and时间相于查询。下面程序是我的合同号和班组两个相于查询。
Dim Gconn As New ADODB.Connection
Dim RsField As ADODB.Recordset
Dim MaTable As String
Dim Num As Long
Dim BaseConn As String
Dim ChaineConn As String
Private Sub cnd1_Click()
dbString = App.Path & "\" & Trim(t1) & ".mdb"
If Dir(dbString) = "" Then
MsgBox "ºÏͬºÅÊäÈë´íÎó£¬ÇëÖØÊÔ", vbInformation, "ad"
Exit Sub
End If
Dim lstrSQL As String
Dim aa As String
listview1.ListItems.Clear
lstrSQL = "" '¶¨ÒåÊý¾Ý¿âºÍ°à×é²éѯ
aa = "" '¶¨ÒåÊý¾Ý¿âÃû×Ö²éѯ
lstrSQL = lstrSQL & "select productinf.*,pipes.* From productinf,pipes "
aa = aa & "select productinf.*,pipes.* From productinf,pipes "
If Trim(c1) = "ËùÓÐ" Then
lstrSQL = aa & "Where (ProductInf.ºÏͬºÅ = '" & t1.Text & "' ) And Pipes.ID=ProductInf.ID"
Else
lstrSQL = aa & "Where (ProductInf.ºÏͬºÅ = '" & t1.Text & "') And (Pipes.°à×é = '" & c1.Text & "') And Pipes.ID=ProductInf.ID"
End If