如何使用设计模式在MS Access中设置运行时数据类型

时间:2014-09-01 08:39:03

标签: ms-access

我一直在研究MS Access。我的学生必须创建一个运行时字段,但我不能在我的生活中确定如何设置数据类型而不进入SQL本身。是否可以使用设计视图来设置类似

的内容
Somefrigginfield (Set data type here e.g. Currency) (Decimal places to round here) : [Somefieldname] *1.10

我在SQL中知道它会类似于

Select ID as int expr1

已经有一段时间但你明白了

(仅供参考,如果这是错误的堆栈,请告诉我在哪里拍摄)

2 个答案:

答案 0 :(得分:2)

在设计模式下打开查询: 在设计视图字段中输入

CalcValue : [Fieldname] * 1.0
SQL中的

看起来像:SELECT ([FieldName] * 1.10) as CalcValue

或:

calcValue : Format([property_Rent],"Currency")

OR:

enter image description here

答案 1 :(得分:2)

也许你的意思是:

SELECT aTable.aNumber, 
       CCur([aInteger])/3 AS [Currency], 
       Round(CCur([aInteger])/3,2) AS Round, 
       Format(CCur([aInteger])/3,"Currency") AS Format
FROM aTable;

在设计视图中

query design

给出下面的结果,您会注意到空字段/列会出错。 Nz函数可能是避免这种情况的最简单方法。

enter image description here

另请参阅:Rounding in Access

相关问题