如何设置选项框? [英] How to set up an Option Box?

查看:50
本文介绍了如何设置选项框?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我正在尝试在表单中设置一个选项框来提供参数查询

用作过滤器。我要过滤的字段是文本字段,

有两个可能的值:A和A。和B。所以我的Option Box应该有三个

选项:A ; " B" :和A;或B或B。 (任何)。非常基本的东西。

我无法让它工作,对于州议员来说,似乎只允许数字作为选项框的数据类型
,如果我尝试使用组合框

(我愿意使用任何能够完成工作的东西),不能得到A。或者

" B"工作。

我相信这对我这里的每个人都很容易。我被困在这里,

请帮忙。

Hi,
I''m trying to set up an Option Box in a form to feed a Parameter Query
to be used as a filter. That field I want to filter is a Text field and
has two posible values: "A" and "B". So my Option Box should have three
options: "A" ; "B" : and "A" Or "B" (any). Pretty basic stuff.
I can''t get it to work, for staters it seems that only numbers are
allowed as data types for option boxes, and if I try to use a combo box
(I''m willing to use anything that does the job), can''t get the "A" Or
"B" to work.
I''m sure this is easy stuff for everyone here but me. I''m stuck here,
please help.

推荐答案

" TetoPR" < WA ***** @ caribe.net>写在

新闻:11 ********************* @ t31g2000cwb.googlegro ups.com:
"TetoPR" <wa*****@caribe.net> wrote in
news:11*********************@t31g2000cwb.googlegro ups.com:

我正在尝试在表单中设置一个Option Box来提供一个
参数查询以用作过滤器。我想要过滤的那个字段是一个文本字段,并且有两个可能的值:A和A。和
B。所以我的Option Box应该有三个选项:A和A。 ; " B" :
和A或B或B。 (任何)。很基本的东西。我无法让它工作,对于州议员来说似乎只允许数字作为选项框的数据类型,如果我尝试使用组合框
(我'我愿意使用任何有效的东西,不能得到
A。或B或B。工作。
我相信这对我这里的每个人都很容易。我被困在这里,请帮忙。
Hi,
I''m trying to set up an Option Box in a form to feed a
Parameter Query to be used as a filter. That field I want to
filter is a Text field and has two posible values: "A" and
"B". So my Option Box should have three options: "A" ; "B" :
and "A" Or "B" (any). Pretty basic stuff. I can''t get it to
work, for staters it seems that only numbers are allowed as
data types for option boxes, and if I try to use a combo box
(I''m willing to use anything that does the job), can''t get the
"A" Or "B" to work.
I''m sure this is easy stuff for everyone here but me. I''m
stuck here, please help.



使用带数字的选项框。我假设表单上有一个

按钮来执行查询。将一些代码放在该按钮的

点击事件中,以创建正确的过滤。如果

您的查询被用作表单或报表的记录源,

将参数从查询中取出并传递给

docmd.openform(openreport)


如果你直接打开查询,(顽皮)那么你将需要一些额外的代码才能得到查询。在打开之前

吧。


private sub btnOpenReport

dim stWhereClause as string

select case me .optionAB

案例1

stWhereClause =" [myfield] =''A''"

案例2

stWhereClause =" [myfield] =''B''"

case else

''如果[myfield]只能是A或B.

stWhereClause =" [myfield] =''A''或[myfield] =''B''"

end select

Docmd.openform" myform" ,,, stWhereClause


在使用之前检查我的代码中的拼写错误。

我有一个过滤器rm有25个选项可以放入报告的

where子句。


-

Bob Quintal


PA是我改变了我的电子邮件地址。


use the option box with numbers. I''ll assume that there is a
button on the form to execute the query. Put some code in the on
click event of that button which creates the right filtering. If
your query is used as the recordsource for a form or report,
take the parameter out of the query and pass it in the
docmd.openform (openreport)

If you are opening the query directly, (naughty) then you''ll
need some additional code to mody hte querydef before opening
it.

private sub btnOpenReport
dim stWhereClause as string
select case me.optionAB
case 1
stWhereClause = "[myfield] = ''A''"
case 2
stWhereClause = "[myfield] = ''B''"
case else
''maybe just leave this blank if [myfield] can only be A or B.
stWhereClause = "[myfield] = ''A'' OR [myfield] = ''B''"
end select
Docmd.openform "myform",,,stWhereClause

Check for typos in my code before using.
I have a filter form that has 25 options that get put into the
where clause for a report.

--
Bob Quintal

PA is y I''ve altered my email address.


TetoPR写道:

我正在尝试在表单中设置一个Option Box来提供参数查询
以用作过滤器。我要过滤的字段是文本字段,
有两个可能的值:A和A。和B。所以我的Option Box应该有三个选项:A ; " B" :和A;或B或B。 (任何)。非常基本的东西。
我无法让它工作,对于州议员来说似乎只允许数字作为选项框的数据类型,如果我尝试使用组合框
(我愿意使用任何有效的东西),不能得到A。或者说B工作。
我相信这对我这里的每个人都很容易。我被困在这里,
请帮忙。
Hi,
I''m trying to set up an Option Box in a form to feed a Parameter Query
to be used as a filter. That field I want to filter is a Text field and
has two posible values: "A" and "B". So my Option Box should have three
options: "A" ; "B" : and "A" Or "B" (any). Pretty basic stuff.
I can''t get it to work, for staters it seems that only numbers are
allowed as data types for option boxes, and if I try to use a combo box
(I''m willing to use anything that does the job), can''t get the "A" Or
"B" to work.
I''m sure this is easy stuff for everyone here but me. I''m stuck here,
please help.



在框架的AfterUpdate事件中,您可以输入类似

Dim strFilter As String

选择Case Me.Frame1

strFilter =" [FieldToFilter] =''A''"

选择Case Me.Frame1

strFilter =" [FieldToFilter] =''B''"

选择Case Me.Frame1

strFilter =" [FieldToFilter] =''A''或 &安培; _

" [FieldToFilter] =''B''

结束选择

Me.Filter = strFilter

Me.FilterOn = True


您可以突出显示任何单词并按F1键,在代码

模块中,以获得进一步的帮助/说明。


In the AfterUpdate event of the frame you could enter something like
Dim strFilter As String
Select Case Me.Frame1
strFilter = "[FieldToFilter] = ''A''"
Select Case Me.Frame1
strFilter = "[FieldToFilter] = ''B''"
Select Case Me.Frame1
strFilter = "[FieldToFilter] = ''A'' Or " & _
"[FieldToFilter] = ''B''
End Select
Me.Filter = strFilter
Me.FilterOn = True

You can highlight any of the words and press the F1 key, while in a code
module, to get further help/description.


好吧,您可以使用向表单添加未绑定的文本框控件,将其设置为''

可见属性不,我会称之为txtChoice。在

您的查询字段中设置标准,如


[Forms]![FormName]![txtChoice]或[Forms]![FormName]! [txtChoice] Null


以上内容全部在查询设计网格中的一行上。并使用正确的表单名称和文本框控件名称替换

FormName和txtChoice,当然是
。将代码添加到选项框控件的Click事件过程中,




选择Case Me!OptionBoxName

案例1

Me!txtChoice =" a"

案例2

Me!txtChoice =" b"

案例3

Me!txtChoice = Null

结束再次选择


,将OptionBoxName和txtChoice替换为正确的名称控制。


hth

" TetoPR" < WA ***** @ caribe.net>在消息中写道

news:11 ********************* @ t31g2000cwb.googlegro ups.com ...
well, you could use add an unbound textbox control to the form, setting its''
Visible property to No. i''ll call it txtChoice. set criteria on the field in
your query, as

[Forms]![FormName]![txtChoice] Or [Forms]![FormName]![txtChoice] Is Null

the above goes all on one line in the query design grid. and replace
FormName and txtChoice with the correct form name and textbox control name,
of course. add code to the Click event procedure of the option box control,
as

Select Case Me!OptionBoxName
Case 1
Me!txtChoice = "a"
Case 2
Me!txtChoice = "b"
Case 3
Me!txtChoice = Null
End Select

again, replace OptionBoxName and txtChoice with the correct names of those
controls, of course.

hth
"TetoPR" <wa*****@caribe.net> wrote in message
news:11*********************@t31g2000cwb.googlegro ups.com...

我正在尝试在表单中设置一个选项框来提供参数查询
以用作过滤器。我要过滤的字段是文本字段,
有两个可能的值:A和A。和B。所以我的Option Box应该有三个选项:A ; " B" :和A;或B或B。 (任何)。非常基本的东西。
我无法让它工作,对于州议员来说似乎只允许数字作为选项框的数据类型,如果我尝试使用组合框
(我愿意使用任何有效的东西),不能得到A。或者说B工作。
我相信这对我这里的每个人都很容易。我被困在这里,
请帮忙。
Hi,
I''m trying to set up an Option Box in a form to feed a Parameter Query
to be used as a filter. That field I want to filter is a Text field and
has two posible values: "A" and "B". So my Option Box should have three
options: "A" ; "B" : and "A" Or "B" (any). Pretty basic stuff.
I can''t get it to work, for staters it seems that only numbers are
allowed as data types for option boxes, and if I try to use a combo box
(I''m willing to use anything that does the job), can''t get the "A" Or
"B" to work.
I''m sure this is easy stuff for everyone here but me. I''m stuck here,
please help.



这篇关于如何设置选项框?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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