设为首页收藏本站Access中国

Office中国论坛/Access中国论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

返回列表 发新帖
查看: 3332|回复: 2
打印 上一主题 下一主题

为什么提示第一行:')'附近有语法错误

[复制链接]
跳转到指定楼层
1#
发表于 2006-12-20 16:57:00 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
Dim strWhere As String  '定义条件字符串
   
    strWhere = "" '设定初始值-空字符串
   
   
    If Not IsNull(Me.Z2) Then
      
        strWhere = strWhere & "([z2] like '" & Me.Z2 & "') AND "
    End If
   
   
    If Not IsNull(Me.Z4) Then
      
        strWhere = strWhere & "([z4] like '" & Me.Z4 & "') AND "
    End If

   
    If Not IsNull(Me.Z5) Then
      
        strWhere = strWhere & "([z5] like '" & Me.Z5 & "') AND "
    End If


If Len(strWhere) > 0 Then
      
        strWhere = Left(strWhere, Len(strWhere) - 5)
    End If
   
    Debug.Print strWhere
   
   
CurrentProject.Connection.Execute ("update sum1 set t1=(select count(z5) from sdmxb where strwhere)")



分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享分享 分享淘帖 订阅订阅
2#
发表于 2006-12-30 23:32:00 | 只看该作者
灌:最后一句中,strwhere是条件串?还是字段?如果是字段,请保证在表“sdmxb”中。。。
3#
发表于 2007-1-5 23:31:00 | 只看该作者


當然出錯

應該這樣寫

CurrentProject.Connection.Execute ("update sum1 set t1=(select count(z5) from sdmxb where " & strwhere & ")")
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|站长邮箱|小黑屋|手机版|Office中国/Access中国 ( 粤ICP备10043721号-1 )  

GMT+8, 2024-4-27 21:34 , Processed in 0.080420 second(s), 26 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表