使用单选按钮过滤子表单 [英] filtering subform using radio buttons

查看:95
本文介绍了使用单选按钮过滤子表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨。


我正在尝试编程我的单选按钮来过滤学生通过/失败的数据,在子表格中称为[前屏幕数据]我使用此处找到的帮助得到了这个但它不起作用,我不知道为什么。我的单选按钮如下

#1 pass

#2失败

#3 both


我的领域是[PassFail]


这就是我所拥有的


Private Sub Frame29_BeforeUpdate(取消为整数)

选择Case Me!Frame29

案例1

Me.Filter =" Pass or Fail = Pass"

Me.FilterOn = True

MsgBox通过或失败=通过

案例2

Me.Filter =通过或失败=失败

Me.FilterOn = True

MsgBox通过或失败=失败

案例3

Me.FilterOn = False

MsgBox"显示所有记录>

结束选择

结束子


任何帮助都会赞赏


谢谢

Hi.

Im trying to program my radio buttons to filter data for student pass/fail in a sub form called [front screen data] I have using help found here got this far but its not working and Im not sure why. my radio buttons are as follow
#1 pass
#2 fail
#3 both

my field is [PassFail]

This is what i have

Private Sub Frame29_BeforeUpdate(Cancel As Integer)
Select Case Me!Frame29
Case 1
Me.Filter = "Pass or Fail = Pass"
Me.FilterOn = True
MsgBox "Pass or Fail = Pass"
Case 2
Me.Filter = "Pass or Fail = Fail"
Me.FilterOn = True
MsgBox "Pass or Fail=Fail"
Case 3
Me.FilterOn = False
MsgBox "Show All Records"
End Select
End Sub

Any help would be appreciated

Thanks

推荐答案

嗨。首先,您需要使用框架的AfterUpdate事件,而不是其BeforeUpdate事件。其次,如果您要过滤的字段称为Pass或Fail,则需要将字段名称括在括号中,如下所示:[Pass or Fail]。第三,文本值''Pass''和''Fail''必须用引号括起来:

Hi. Firstly, you''ll need to use the AfterUpdate event of your frame, not its BeforeUpdate event. Secondly, if the field you are filtering on is called Pass or Fail you will need to enclose the field name in brackets, like this: [Pass or Fail]. Thirdly, the text values ''Pass'' and ''Fail'' must be enclosed in quotes:

展开 | < span class =codeLinkonclick =selectAll(this);>选择 | Wrap | 行号


非常感谢sooooo。这非常有效。我试图将字段名称放在括号中,但是当我这样做时,我删除了导致错误的语音标记。虽然没有考虑引号。


还考虑了子表格位但是试图将其添加到[前端子表单]![通过或失败]所以没有工作。这非常有效。我永远感激


Jody
Thanks sooooo much. This worked perfectly. I had tried to put the field name in brackets but when I did this i removed the speech marks causing an error. Didnt think about the quotation marks though.

Also thought about the subform bit but tried to add that to [frontend subform]![pass or fail] so didnt work. This worked perfectly. I am forever grateful

Jody


好的,所以只是注意到了一些东西......在选择我的部分之前添加了语法,现在当我使用它有点工作的形式。


当我按下pass时屏幕工作正常并显示所有已经通过但当我选择失败时子窗体刷新但保持不变(显示全部通过)所以当我选择两者相同时发生(显示全部通过)


任何想法???
Ok so just noticed something...added the syntax just before the select case me part and now when I use the form it sort of works.

The screen when I press pass works fine and shows all that have passed but when I select fail the subform refreshes but remains the same (showing all passed) so when I select Both the same happens (showing all passed)

any ideas???


这篇关于使用单选按钮过滤子表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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