有没有办法允许用户选择组合框的比较选项? [英] Is there a way to allow the user to select the comparison option for a combo-box?

查看:52
本文介绍了有没有办法允许用户选择组合框的比较选项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个包含6个选择字段的大型查询,我允许用户从1个单一输入表单中选择任何一个。


Form SearchForm上的6个选项字段为:Track ,Distance,Surface,Track_Condition,Final_Pos和Race_Type。 6个特定的组合框是cboTrack,cboDistance,cboSurface,cboTrkCond,cboFinalPos和cboRaceType。


我已经设置了一个查询/过滤器,使用选择标准[Forms]![SearchForm]![cboTrack]等...以交替方式设置,以便任意组合在6个组合框中,将数据过滤到所选择的内容。这完全符合我的预期。


我的问题是,我希望允许用户选择与FinalPos组合框一起选择运算符选项<,< =,=,>,> =与cboFinalPos输入一起使得理论上他们可以说< 3并过滤除位置1和1之外的所有数据。 2 ...依此类推。


我在这一点上的努力是创建一个名为cboOperators的新组合框,但我在获取现有查询时遇到了困难上班。我尝试在过滤器查询的Final_Pos字段中放置代码[Forms]![SearchForm]![cboOperators] [Forms]![SearchForm]![cboFinishPos],希望如果用户选择<< ",Access将其读作< [cboFinishPos]并相应地过滤。错误是您输入的表达式包含无效语法。你可能已经输入了一个没有操作员的操作数。


首先我想做什么,如果是的话,我做错了什么?

I have a large query with 6 selection fields that I allow the user to choose any and all from 1 single input form.

The 6 option fields on Form SearchForm are: Track, Distance, Surface, Track_Condition, Final_Pos and Race_Type. The 6 particular combo boxes are cboTrack, cboDistance, cboSurface, cboTrkCond, cboFinalPos and cboRaceType.

I''ve set up a query/filter that works using the selection criteria [Forms]![SearchForm]![cboTrack]etc... in alternating manners so that any combination of the 6 combo-boxes will filter the data to exactly what is chosen. This works exactly how I wish it to.

My question is, I wish to allow the user to select in conjunction with the FinalPos combo-box, an operator option <, <=, =, >, >= along with the cboFinalPos input so that in theory, they could say < 3 and filter out all data except Positions 1 & 2...and so on and so forth.

My effort at this point has been to create a new combo-box entitled cboOperators but I am running into difficulty in getting the existing query to work. I attempted, in the Final_Pos field of the filter query, to place the code [Forms]![SearchForm]![cboOperators][Forms]![SearchForm]![cboFinishPos] in, hoping that if the user selected "<", Access would read it as <[cboFinishPos] and filter accordingly. The error is "The Expression You Entered Contains Invalid Syntax. You may have entered an operand without an operator."

Is what I''m trying to do possible first off and if so, what am I doing wrong?

推荐答案

是的,但是你需要做的是构建和IF。或案例用于评估包含所需操作符的下拉列表值的语句,因为您无法像现在一样将操作符作为文本传递。


尝试这样的事情...

Yes it is possible, but what you need to do is build and "IF" or "Case" statement that evaluates the value of the drop down that contains all the operators you want, because you cannot pass operators as text as you are doing now.

Try something like this...

展开 | 选择 | Wrap | 行号


好吧,我会说实话......我对Case和SQL本身的知识有限,知道从哪里开始实现它。


现在,我的过滤器查询名为Selection_All和那个SQL很大。我对如何为它做SQL的所有知识都超出了基本的MS Access查询设计屏幕,因此这里的代码比我预期的要大得多,所以我提前道歉。如果有更简化的方法来执行此操作,请告诉我。


我希望找出
Okay, I''ll be honest...I have limited knowledge of Case and SQL itself to know where to begin implementing this.

Right now, my filter query is entitled Selection_All and the SQL for that is huge. All my knowledge on how to do the SQL for it is out of the basic MS Access Query Design screen so the code here is far more massive than I expected so my apologies in advance. If there''s a more streamlined method to do this, please let me know.

And I''m hoping to figure out the method that
展开 | 选择 | Wrap | 行号


在我开启之前,这个查询用于什么?它是表单的记录集吗?


-AJ
Before I take this on, what is this query being used for? Is it a recordset for a form?

-AJ


这篇关于有没有办法允许用户选择组合框的比较选项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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