处理VBA中的关系 [英] Handling Ties in VBA

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

问题描述

嗨伙计,


我有一个Access 2003应用程序处理小艇赛车结果。我正在寻找一种处理关系的方法。在当前的第一个记录集传递中,如果没有关系(orig点),结果就可以了。如果存在联系,那么它们需要由识别关系存在的过程(经过时间)处理并且将原始值(Orig Points)加在一起并除以关系数以创建新值(Points Reqd)。如下表所示。


相信这是有道理的,你们可以推荐一些合适的代码...最好的问候,Brian



记录经过时间折扣积分要求


1 5.5 1 1

2 5.6 2 3

3 5.6 3 3

4 5.6 4 3

5 5.7 5 5

6 5.7 6 5

7 5.8 7 7

8 5.9 8 8

Hi Folks,

I have an Access 2003 application handling dinghy racing results. I''m looking for a way to handle ties. On the current first recordset pass, the results are fine if there are no ties (orig points). If there are ties, then they need to be handled by a process that recognises that ties exist (elapsed time) and adds together the original values (Orig Points) and divides by the number of ties to create new values (Points Reqd). As in the table below.

Trust this makes sense and that you folks can suggest some suitable code ... with best regards, Brian


Record Elapsed time Orig Points Points Reqd

1 5.5 1 1
2 5.6 2 3
3 5.6 3 3
4 5.6 4 3
5 5.7 5 5
6 5.7 6 5
7 5.8 7 7
8 5.9 8 8

推荐答案

helm,


您是尝试使用SQL,还是使用VBA?为此?


最重要的是,您的要求是什么?您试图从此数据库中提取哪些信息?很明显你目前正处于设计阶段,所以让我们讨论。


最后,当你放下一个数据表时,你应该将它包含在CODE标签中或者其他一些,这样我们就可以轻松阅读。像这样:
helm,

Are you trying to use just SQL, or are you using VBA for this?

Most importantly, what are your requirements? What sorts of information are you trying to extract from this database? It is pretty obvious that you are currently in the design phase, so let''s discuss.

Finally, when you put down a data table, you should probably enclose it in CODE tags, or some such, so that we can read it easily. Like this:
展开 | 选择 | Wrap | 行号


这是我的基于代码的方法,已经过测试,似乎运行良好。逻辑是:
Here is my Code Based approach that has been tested and appears to work quite well. The Logic is:
  1. 创建一个包含唯一经过时间的记录集。
  2. 循环遍历此Recordset测试每个经过时间以查看是否存在领带。
  3. 如果有领带:
  1. Create a Recordset consisting of Unique Elapsed Times.
  2. Loop through this Recordset testing each Elapsed Time to see if there are Ties.
  3. If there are Tie(s):
  1. 计算这些领带的总原始分数。
  2. 计算实际的领带数。
  3. 使用公式计算原始点的新值:
  1. Calculate the Total Original Points for these Ties.
  2. Calculate the actual Number of Ties.
  3. Calculate the new Value for Original Points using the Formula:
展开 | 选择 | 换行 | 行号


嗨Adezii,


那是'br illiant - 找到关系和更新记录,我们可以更进一步吗?在你的解决方案中,所有关系都被赋予相同的值 - 很棒 - 但是有些值不是整数 - 例如,如果在[orig points] 5和6处有关系,则要分配的值[points reqd]将是5 + 6/2 = 5.5


我认为我可以从整数值改为单一但结果仍然是整数...


问候,头盔
Hi Adezii,

That''s brilliant - finds ties and updates records, Can we take this a step further please? In your solution, all the ties are given the same value - great - but there are some values that would not be integers - if for example there were ties at [orig points] 5 and 6, the values to be assigned [points reqd]would be 5+6/2 = 5.5

Thought I could change through from integer values to single but results still come out as integers ...

Regards, Helm


这篇关于处理VBA中的关系的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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