随机化过滤器 [英] Randomizing a filter

查看:83
本文介绍了随机化过滤器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试随机化我的过滤器。我有一个表格,其记录的可能值为Easy,Medium或Hard。


用户通过组合框进行选择。选择之后我会像这样激活Filter属性


Private Sub cboDifficulty_Click()

Dim strFilterDifficulty As Variant

strFilterDifficulty =表格!frmGuess.cboDifficulty


Me.Filter =" Word_Difficulty =''" &安培; strFilterDifficulty& "''"

Me.FilterOn = True

Me.txtAnswer = Word_Description

''得到单词的长度

调用WordLength(Me.txtAnswer)

结束子


根据组合框值过滤我的记录集,从1开始次数。它显然总是以相同的顺序出现。我想做的是每次随机化订单。


任何想法?

I am trying to randomize my filter. I have a table with a record that has a possible value of "Easy", "Medium", or "Hard".

The user makes a choice by a combo box. After it is chosen I activate the Filter property like so

Private Sub cboDifficulty_Click()
Dim strFilterDifficulty As Variant
strFilterDifficulty = Forms!frmGuess.cboDifficulty

Me.Filter = "Word_Difficulty = ''" & strFilterDifficulty & "''"
Me.FilterOn = True
Me.txtAnswer = Word_Description
'' get the length of the word
Call WordLength(Me.txtAnswer)
End Sub

This filters my recordset based on the combo box value and starts at the 1st occurance. It always appears in the same order obviously. What I would like to do is randomize the order each time.

Any ideas?

推荐答案

嗯...什么关于创建一个新列的查询,该列只返回从1到1的随机数...让我们说32,767,然后排序呢?然后你可以使用该查询作为表单的记录源。
Hmm... what about a query that creates a new column that just returns a random number from 1 to... let''s say 32,767 and then sort by that? Then you can just use that query as the recordsource for the form.


那里。


最明显的想法是添加一个字段到源表并在应用过滤器之前用随机值填充它。如下所示。

Hi, there.

The most obvious idea is to add a field to the source table and fill it with random values before applying filter. Like the following.

展开 | 选择 | Wrap | 行号


查询似乎无法使用随机数字。好吧,你总是可以在表格中创建列,然后使用记录集循环来随机化数字。
Query doesn''t seem to work with randomizing numbers. Well, you could always create the column in the table and then use a recordset loop to randomize the numbers.


这篇关于随机化过滤器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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