表中的两个字段名:(字符型)(日期型)
Name    Date
Jek        2003-01-05
Tom      2003-02-10
Lee       2003-02-15
Roes     2003-03-01
Kett       2003-03-01返回查询结果要同时满足两个条件:
1. Name 字段内容包含 Text1.Text 中的字符
2. Date 字段为等于系统时间的行我写了一部分,但其中满足条件2的代码不会写。
Dim WithEvents adoRS As Recordset
Dim db As Connection
Dim sU As String
Dim U As String  sU = App.Path
  If Right(sU, 1) <> "\" Then
    sU = sU + "\"
  End If
    sU = "Provider=Microsoft.Jet.OLEDB.3.51;Persist Security Info=False;Data Source=" & sU & "\Abc.mdb;Jet OLEDB:Database;"  U = Text1.Text
  
  adoRS.Close
  Set adoRS = New Recordset
  db.CursorLocation = adUseClient
  db.Open sU
  
  '返回:Name字段中包含Text1.Text字符的所有行
  adoRS.Open "select * from Abc where Name like '%" & U & "%' order by Date", db, adOpenStatic, adLockOptimistic
  '如果加上条件2,该在where Name like '%" & U & "%' 后面加点什么代码是不是?and ......?  Set DateGird1.DataSource = adoRS  'DateGird1 表格控件返回数据行
  DateGird1.Refresh

解决方案 »

  1.   

    select * from Abc a,(select '当前日期'=GETDATE()) b where Name like '%" & U & "%'    and a.date=b.当前日期  order by a.Date
    不知道是否可以。
      

  2.   

    GETDATE()函数是SQL-Server中的函数 
    不知道在Access中行不行?查一下Access中的帮助吧。
      

  3.   

    呀,慢了点是  cbr7619(cbr7619)  的写法. sorry.用AND 或者 OR 等啦.
      

  4.   

    "select * from Abc where Name like '%" & U & "%' AND Date = '"  & Format(Date(),"yyyy-MM-dd") & "' order by Date"
      

  5.   

    在sqi-server中用GETDATE()函数 也可用Format(Date(),"yyyy-MM-dd")
    在Access可用Format(Date(),"yyyy-MM-dd")失败,返回始终为空 因为表中没有今天(系统日期)的数据
      

  6.   

    select * from Abc where Name like '%" & U & "%' AND Date = '"  & Format(now(),"yyyy-MM-dd") & "' order by Date"
      

  7.   

    select * from Abc where Name like '%" & U & "%' AND Date = '"  & Format(now(),"yyyy-MM-dd") 
      

  8.   

    失败!
    数据库:Access97 ,Date 字段的数据为自动添加系统日期(yy-mm-dd),Date$(),中日期。
    VB6
      

  9.   

    select * from Abc where Name like '%" & U & "%' AND Date = #"  & Format(now(),"yyyy-MM-dd") & " #"  在 Access97 中
      

  10.   

    Access:
    select * from Abc where Name like '*" & U & "*' AND Date = #"  & Format(now(),"yyyy-MM-dd") & "#"  
      

  11.   

    帮忙看看
    http://expert.csdn.net/Expert/topic/1609/1609199.xml?temp=.3270838
      

  12.   

    "select * from Abc where Name like '%" & U & "%' and date = date() order by Date",