[英]How would I convert this excel formula into a MS Access or VBA?
Try something like this: 尝试这样的事情:
=IIF(([Rollover]+[Bucket])>0,0,([Rollover]+[Bucket])) = IIF(([[Rollover] + [Bucket])> 0,0,([[Rollover] + [Bucket])))
Although, your Excel formula references D2 and C3, in different rows. 虽然,您的Excel公式在不同的行中引用了D2和C3。 That's going to be a bit tricky in Access if that's what you really need to do.
如果您确实需要这样做,那么在Access中将有些棘手。 It is possible to do, if that's what you really want, but you may need to add a ROW Number field (or an autonumber ID field) in order to do that.
如果那是您真正想要的,则可以执行此操作,但是您可能需要添加ROW Number字段(或自动编号ID字段)才能执行此操作。
Blair 布莱尔
Editted: (since I just read the "see more comments") 编辑:(因为我刚刚阅读了“查看更多评论”)
The quick and dirty way to do this is to add the RowNumber field, the make a query from the dataset with a calculated field output NextRowNumber: [RowNumber]+1. 快速而肮脏的方法是添加RowNumber字段,从数据集中进行查询,并使用计算出的字段输出NextRowNumber:[RowNumber] +1。 Link the query and the dataset together with RowNumber and NextRowNumber.
将查询和数据集与RowNumber和NextRowNumber链接在一起。 Use the [Rollover] field from the query ([Query]![Rollover] and the [Bucket] field from the dataset ([dataset]![Bucket]) in the equation above.
在上面的公式中,使用查询的[Rollover]字段([Query]![Rollover]和数据集的[Bucket]字段([dataset]![Bucket])。
There is likely a more elegant way to do this in VBA, but the linked query / dataset should work. 在VBA中可能有一种更优雅的方法来执行此操作,但是链接的查询/数据集应该可以工作。
Blair 布莱尔
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.