简体   繁体   English

如何将字段显示为货币但数据类型为文本 - Access 2013

[英]How to show a field as Currency but with the data type being Text - Access 2013

In my Access iv'e got a form in which I want to display several table-bound (record source) fields as Currency, with their table datatype being Text.在我的 Access 中,我有一个表单,我想在其中将几个表绑定(记录源)字段显示为货币,它们的表数据类型为文本。

I can't seems to get this done.我似乎无法完成这件事。 What I tried so far to achieve this:到目前为止,我为实现这一目标所做的尝试:

  • Use a Format in the controlsource of the field so (in the controlsource of the field): =Format(MyTextNumber; "Currency") - Results in #Type error (Circular reference)在字段的控制源中使用Format (在字段的控制源中): =Format(MyTextNumber; "Currency") - 结果在 #Type 错误(循环引用)
  • Use CCur in the controlsource of the field: =CCur(MyTextNumber) - This returns all 0.00 amounts (with the currency symbol though) and also a Circular reference Error in the design.在字段的控制源中使用CCur=CCur(MyTextNumber) - 这将返回所有 0.00 金额(尽管带有货币符号)以及设计中的循环引用错误。
  • Instead of using the table as Recordsource in the form I used a query as Recordsource in which I created another field based on the Field I try to change: SELECT *, Format(MyTextNumber, "Currency") as MyTextNumberWithFormat FROM SomeTable I then used the MyTextNumberWithFormat as controlsource, this returns good values but I can't edit these values directly because it is based on an expression.我没有在表单中使用table作为记录源,而是使用查询作为记录源,其中我根据尝试更改的字段创建了另一个字段: SELECT *, Format(MyTextNumber, "Currency") as MyTextNumberWithFormat FROM SomeTable然后我使用了MyTextNumberWithFormat作为控制源,这会返回良好的值,但我无法直接编辑这些值,因为它基于表达式。
  • Also tried to create a hidden field with the controlsource and create an 'empty controlsource field' that uses the hidden field as its value and then write my own UPDATE statement when the field is being changed (but couldn't get this to work either).还尝试使用控制源创建一个隐藏字段,并创建一个使用隐藏字段作为其值的“空控制源字段”,然后在更改该字段时编写我自己的UPDATE语句(但也无法使其工作) .

Any other suggestions?还有其他建议吗?

Additional information:附加信息:

I also tried to set the Format/Notation on Currency/Euro in the Formatting tab of the field but this also doesn't have any effect, though what is kinda interesting is the fact that when I use =Sum(MyField) as Recordsource, then the Format/Notation Currency DOES work.我还尝试在字段的格式选项卡中设置货币/欧元的格式/符号,但这也没有任何效果,尽管有点有趣的是当我使用=Sum(MyField)作为记录源时,那么格式/符号货币确实有效。

SELECT Table1.Test, Format([test],"Currency") AS Expr1
FROM Table1;

this worked for me, I've entries of "£123.45" and "123.45" and were presented in currency.这对我有用,我输入了“£123.45”和“123.45”,并以货币形式显示。 You had ;你有; in your's在你的

Results in #Type error (Circular reference)导致 #Type 错误(循环引用)

Then rename your textbox to something else than MyTextNumber .然后将您的文本框重命名为MyTextNumber以外的其他MyTextNumber

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Access 2013在表单中增加文本ID字段 - Access 2013 Increment a text ID field in a form 如果使用 Access 2013 vba 选中多个框,则用文本填充文本框字段并连接文本 - Fill in Text box field with text and concatenate text if multiple boxes are checked using Access 2013 vba 如何在Word 2013 VBA中正确访问旧版表单字段复选框? - How to properly access Legacy Form Field checkboxes in Word 2013 VBA? 访问 VBA:无效的字段数据类型 - Access VBA: Invalid field data type 使用访问查询更改数据字段类型 - Change data field type using access query 如何将 Access 字段类型从 Yes/No 更改为 Short Text? - How do you change an Access field type from Yes/No to Short Text? 如何根据 Access 2013 中第一个字段的选择来自动填充第二个字段? - How can I get a second field to auto populate based on the selection of the first field in Access 2013? 如何格式化Access窗体中的文本框字段以显示与导入到表中的文件相同的数据 - How to format textbox field in Access form to show data the same as in imported file to the table Ms Access 中如何将access 中列的数据类型从短文本转换为日期? - How to convert the data type of a column in access from short text to date in Ms Access? 检查某个字段在Access 2013中是否没有焦点 - Check if a field does not have focus in Access 2013
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM