上一季度更新记录VBA代码 [英] Last Quarterly Updated Record VBA Code

查看:87
本文介绍了上一季度更新记录VBA代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我讨厌这样做..但是,任何人都可以一块一块地告诉我这是做什么的吗?

I hate to do this..but can anyone tell me exactly what this is doing, piece by piece?

展开 | 选择 | 换行 | 行号

推荐答案

从外面开始工作:

(虽然,我实际上从内部开始并解决了(^ - ^)0


格式:尝试使用系统的短日期格式返回计算值通常是m / dd / yy

我的系统短日期设置为 mm / dd / yyyy因为我有需要该表格的数据库at;因此在我的系统上:

(= 09/30/2013)


First DateAdd:试图从给定日期减去1秒,在这种情况下计算

(= 09/30/2013 11:59:59 PM)


Second DateAdd:试图增加季度数在dateiff函数中计算到1/1/1900

(= 10/01/2013)


DateDiff:试图计算季度数在今天的日期(2013-11-11)和1/1/1900之间

(= 455)


输入时会出错
日期哪个会给你一个#NAME?或#Type!计算出的控制/字段中的错误应该是 Date()
Starting from the outside working in:
(although, I actually started from the inside and workded out (^-^) 0

Format: Is attempting to return the calculate value using the "short date" format of your system usually m/dd/yy
My System short date is set to "mm/dd/yyyy" because I have databases that require that format; thus on my system:
(=09/30/2013)

First DateAdd: Is attempting to subtract 1 second from the given date, which in this case is calculated
(=09/30/2013 11:59:59 PM)

Second DateAdd: Is attempting to add the number of quarters being calculated in the datediff function to 1/1/1900
(=10/01/2013)

DateDiff: Is attempting to calculate the number of quarters between today''s date (2013-11-11) and 1/1/1900
(= 455)

As entered this will error
Date which will give you a #NAME? or a #Type! error in the calculated control/field it should be Date()


展开 | 选择 | Wrap | 行号


Zmbd说明SQL引擎(Jet)不会将Date识别为函数调用Date()。这需要修改。


添加23小时59分59秒不是那么正确而不是减去一秒;-)


基本上,该部分是减去一天的粗略方式,因为它取决于起始位置是午夜,并且所有剩余时间通过将其格式化为日期而被剥离。使用''d'参数会更有意义。
Zmbd is correct in stating that the SQL engine (Jet) will not recognise Date as the function call Date(). This needs to be amended.

Not so correct in adding 23 hours, 59 minutes and 59 seconds instead of subtracting a second though ;-)

Essentially, that part is a crude way of subtracting a day as it depends on the start position being midnight and all remaining hours being stripped by formatting it simply as a date. Using a parameter of ''d'' would have made more sense.


这篇关于上一季度更新记录VBA代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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