随机化Access表列中的数据 [英] Randomizing data in an Access table column

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

问题描述

MS Access


是否可以在一列中随机化数据,同时保持表的其余部分不变。我可以轻松地使用查询来拉取列,然后通过随机数字段进行排序,但是在没有关系的情况下将问题放回到我的表中会有问题。


数据库要保留跟踪我们在学校的储物柜上放置的锁。每个学期,我都要随机化每个区域的锁,以便员工可以使用报告将锁移动到新的随机位置,而不是随意移动锁并将新位置输入数据库。任何帮助或建议将不胜感激。


谢谢,

MS Access

Is it possible to randomize data in one column while keeping the rest of the table intact. I can easily use a query to pull the column and then sort via a random number field, but am having issues putting it back into my table without a relationship.

The database is to keep track of the locks we have placed on lockers in our school. Every semester, I want to randomize the locks in each area so that staff can use a report to move the locks to their new random locations, rather than randomly move the locks on their own and input the new locations into the database. Any help or suggestions would be appreciated.

Thanks,

推荐答案

有点不清楚你想要什么。


您是否要求以随机顺序说出1到50之间的所有数字?例如43,20,17,15,50,1 ....等


Phil
It''s a little unclear what you want.

Are you asking for say all the numbers between 1 and 50 in a random order? e.g. 43,20,17, 15,50, 1 .... etc.

Phil


  1. 这实际上可以做到,虽然它可能不那么简单。一种方法是:
  1. This can actually be done, though it may not be so simple. One Method would be:
  1. 根据您的表创建一个Recordset。
  2. 对于指定数量的迭代,创建两个随机记录记录集中的数字(绝对位置)。
  3. 移动到第一个随机位置并在[LockNum]字段中检索值。
  4. 移动到第二个随机位置并检索值在[LockNum]字段中。
  5. 交换这两个值并更新Recordset中的[LockNum]字段。
  6. 您执行的迭代次数越多,随机交换的随机性越大位置#1可以等于随机位置#2。
  7. 保持所有其他字段值,仅交换更衣室号。

  • 可能更容易方法,但现在没有想到。
  • 如果您有兴趣,请告诉我,我会发布逻辑和代码。
  • 正是我提出的。


    Phil
    Exactly what I came up with.

    Phil


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

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