如何为中位数编写代码 [英] How to write code for Median

查看:171
本文介绍了如何为中位数编写代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个显示Max,Min,Avg和Median的文本框。我有所有期望中位数的代码。有人可以帮忙吗。

示例:对于Max,我刚进入文本框的属性,然后在控制源中我输入= Max([Engine Price Est])。什么是中位数?

解决方案

这不能用标准函数来完成,因为无法确定一组数字的中间点你会需要一个如下所示的新功能:

展开 | 选择 | Wrap | 行号



这不能通过标准功能来完成,因为无法确定一组数字中的中间点,您将需要一个如下所示的新功能:

展开 < span class =codeDivider> | 选择 | Wrap | Line数字



您的代码:

Dim db作为DAO.Database

Dim rs As DAO.Recordset


DAO是否只适用于较新版本的Access?

如果我在Access 97中这样做怎么办?它还能用吗?我输入了你给我的代码,我得到了一行它不喜欢的代码。以红色显示的代码行是:

设置rs = db.OpenRecordset(" SELECT [Engine Price Est] FROM FROM Areas with quots&

" ORDER BY [Engine Price Est];"


我不知道问题是什么?你能帮忙吗?



转到VBA编辑器窗口中的工具 - 参考,并确保勾选了Microsoft DAO库。


将代码更改为...


设置rs = db.OpenRecordset(" SELECT [Engine Price Est] FROM [所有带加法的区域]"& _

" ORDER BY [Engine Price Est ];")


I have a textbox that shows Max, Min, Avg, and Median. I have the code for all expect Median. Can somebody please help.
Example: For Max, I just went into the properties of the textbox, then in the control source I just put in =Max([Engine Price Est]). What would it be for Median?

解决方案

This cannot be done with a standard function as there is no way to decide the half way point in a set of numbers you will need a new function like the following:

Expand|Select|Wrap|Line Numbers


This cannot be done with a standard function as there is no way to decide the half way point in a set of numbers you will need a new function like the following:

Expand|Select|Wrap|Line Numbers


Your code:
Dim db As DAO.Database
Dim rs As DAO.Recordset

Does DAO only work with the newer versions of Access?
What if I was doing this in Access 97? Would it still work? I put in the code you gave me and I got a line of code that it didn''t like. The line of code that was shown in red is:
Set rs = db.OpenRecordset("SELECT [Engine Price Est] FROM All Areas with additions " &
"ORDER BY [Engine Price Est];"

I don''t know what the problem is? Can you help?

Go to Tools - References in the VBA Editor window and make sure that the Microsoft DAO library is ticked.

Change code to ...

Set rs = db.OpenRecordset("SELECT [Engine Price Est] FROM [All Areas with additions] " & _
"ORDER BY [Engine Price Est];")


这篇关于如何为中位数编写代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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