运行时错误3075语法错误 [英] run time error 3075 Syntax error

查看:93
本文介绍了运行时错误3075语法错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,


这个让我非常好。在我的过滤器中输入的查询将在Access中作为独立查询工作,但当我尝试通过按钮运行时,我一直收到语法错误。我认为它可能与我的文本标准周围的单引号有关,但我也试过双引号。如果有人可以帮助我会非常感激。我实际上让它工作了一次,然后又添加了关于(Count_Stations.STATUS)=''Active''和(Traffic.COUNT_STATUS)=''更新''的标准然后它就行不通了。我尝试删除这些仍然没有运气。语法被复制到Access的SQL视图中,它在那里工作正常。



谢谢Ramprat

展开 | 选择 | Wrap | 行号

解决方案

首先,我将完全删除WHERE子句并确保它运行。然后我会尝试从WHERE子句中删除所有不必要的括号。我一直在使用两个双引号(txt而不是单引号),但是根据我的意思,任何一个都应该可以工作。


嗨。为了清楚起见,我在代码之前和之后添加了代码标记。


一个问题是使用表单控件引用,它在查询编辑器中正常工作但从代码运行时失败(因为Jet数据库引擎没有将它们视为有效的字段名称)。您应该在控件名称的位置替换控件的值,如下面的一个示例所示。如果表单控件引用是字符串值,请在引用之前和之后使用单引号,如第二个版本所示:

展开 | 选择 | 换行 | 行号


谢谢筹码。我试图摆脱Where的所有东西。在,仍然有同样的错误?!?所以我知道这不是引用


斯图尔特感谢您添加代码标签(我将来一定会这样做)以及您的建议但是因为我'已经从Where上删除了所有内容,因此删除了对表单控件的任何引用我仍然遇到问题所以我不知道这是不是问题。真正令人恼火的是,在中午的某个时刻,这实际上有效,直到我添加了关于status = active和count_status = updated的附加标准。在那之后,即使删除了标准,我也无法让它再次工作。


这是盯着我的那些东西之一,我看不到它

Hi everyone,

This one is stumping me really good. The query entered in my filter below will work as a stand alone query in Access but I keep getting a syntax error when I try to run it through a button. I thought it could have something to do with the single quotes around my text criteria but I tried double quotes as well. If anyone can help I''d be so grateful. I actually had it working once and then went and added the criteria about (Count_Stations.STATUS) = ''Active'' and (Traffic.COUNT_STATUS) = ''Updated'' and then it wouldn''t work. I tried removing these and still no luck. The syntax is copied right out of the SQL view in Access and it''s working fine there.


Thanks Ramprat

Expand|Select|Wrap|Line Numbers

解决方案

First, I''d remove the WHERE clause altogether and make sure it ran. Then I''d try removing all the unneccesary parentheses from the WHERE clause. I''ve been using two double quotes (""txt"") instead of single quotes, but either one should work as far as I know.


Hi. I have added code tags before and after your code for clarity.

One problem is the use of the form control references, which work OK in the query editor but fail when run from code (as the Jet database engine does not see them as valid field names). You should substitute the values of the controls in the place of the control names, as shown for one such example below. If the form control reference is a string value, use single quotes before and after the reference as shown in the second version :

Expand|Select|Wrap|Line Numbers


Thanks Chip. I tried getting rid of everything from the "Where" on and still got the same error?!? So I know it isn''t the quotes

Stewart thanks for adding the code tags (I''ll be sure to do that in the future) and for your suggestion but since I''ve removed everything from the Where on and thus removed any references to form controls I''ve still got the problem so I don''t know if that was the problem. What is really aggravating is that at one point around noon this actually worked until I added in the additional criteria about status = active and count_status = updated. After that I couldn''t get it to work again even with removing the criteria.

Is it one of those things that is staring me in the face and I can''t see it?


这篇关于运行时错误3075语法错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆