如何解决查询过于复杂的问题 [英] How do I workaround query being too complex

查看:93
本文介绍了如何解决查询过于复杂的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我以为我已经完成了我的数据库,一切都运行良好,但在进入查询后我的子表单基于并简单地将字段从升序变为降序,然后关闭它并尝试打开我的表单,我得到了查询过于复杂的问题。错误,然后everthing南下。访问自行关闭,文件无法恢复。幸运的是我用其他2个备份保存了这个文件!我再次测试了。如果我不接触任何其他东西,那么表格中的一切工作正常,但只需打开和关闭查询(不试图改变任何东西),相同的过于复杂的情景。再次发生。


查询有13个字段,其中8个字段的条件与此类型相似:


[Forms]![frmRevisionAudit ]![cboRevisionAudit]或[Forms]![frmRevisionAudit]![cboRevisionAudit] Null。


其中一个字段有[Forms]![frmRevisionAudit]![cboYear]或[Forms]![frmRevisionAudit]![cboYear] =" All"。


一旦我关闭它,如果我重新打开它,查询已经通过用各种可能的标准组合填充行来重组自己,以便将我的结果返回到基于7的主表单组合框过滤器。


有没有办法让我说出这个或以不同的方式构造它,或者使用不同的措辞来获得我想要的结果而不会让我的查询sql长达一英里?

我真的很感激任何帮助或建议。我仍然是Access的业余爱好者,如果这是一个常见的错误,我完全愿意被称为dunderhead。 :)我只关心学习,改进和达到最终的工作结果。


非常感谢!

解决方案

尝试在此处发布完整的SQL语法。你是只在Access内部工作,还是在后端运行访问数据库(如果是,那是什么类型的?)


感谢回复Smiley!


所有这一切都在Access中完成。不幸的是,当进入查询设计视图的条件部分时,看起来很简单,膨胀成一个巨大的sql语句。我将只发布一个片段(仍然很大),因为发布整个语句太麻烦了。希望这会给你一个想法。

展开 | 选择 | Wrap | 行号


我会采用不同的方法。

对于表单上的每个文本框,我要添加:

展开 | 选择 | Wrap | 行号

I thought I was done with my database, everything was working great, but after going into the query that my subform is based on and simply changing a field from ascending to descending, then closing that and trying to open my form, I got the "query is too complex" error and then everthing went south. Access closed itself and the file was unrecoverable. Luckily I had saved this file with 2 other backups! I tested again. Everything works fine in the form if I don''t touch anything else, but just by opening and closing the query (without trying to change anything), the same "too complex scenario" happens again.

The query has 13 fields, with 8 of them having had criteria similar to this typed in them:

[Forms]![frmRevisionAudit]![cboRevisionAudit] Or [Forms]![frmRevisionAudit]![cboRevisionAudit] Is Null.

One of the fields had the criteria [Forms]![frmRevisionAudit]![cboYear] Or [Forms]![frmRevisionAudit]![cboYear] = "All".

Once I close this, if I open it back up, the query has restructured itself by filling the rows with every possible combination of criteria to return my results to the main form based on 7 combo box filters.

Is there a way for me to word this or structure this differently or use different phrasing to get my desired results without bloating my query sql a mile long?

I really appreciate any help or suggestions. I''m still an amateur at Access and am fully willing to be called a dunderhead if this is a common mistake to avoid. :) I only care about learning, improving, and getting to the final working end result.

Thanks so much!

解决方案

Try posting your full SQL syntax here. Are you working only internally in Access, or does the access database run of a backend (and if so, what kind?)


Thanks for replying Smiley!

All of this is done in Access alone. Unfortunately, what seems simple when entering into the criteria section of the query design view, bloats into a huge sql statement. I''m going to only post a snippet (which is still big) because posting the entire statement would too cumbersome. Hopefully this will give you the idea.

Expand|Select|Wrap|Line Numbers


Well I would a different approach.
To each of your textboxes on the form, I would add:

Expand|Select|Wrap|Line Numbers


这篇关于如何解决查询过于复杂的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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