如何编辑格式化的日期/时间字段 [英] How to Edit a formatted Date/Time field

查看:551
本文介绍了如何编辑格式化的日期/时间字段的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个名为tblTIMES的表中有两个日期/时间字段[ClockIN]和[ClockOut],每个字段都存储格式为(mm / dd / yy hh:nn:ss AMPM)的日期和时间。


我使用格式(" ClockIn,mm / dd / yyyy)"和格式(ClockIn,hh:nn:ss AMPM)"将我需要的相应日期或时间分开。


其中一个地方是表格上的文本框,我想用它来编辑日期和/或时间特定记录。


这似乎不起作用。


我可以成功显示格式化的日期或时间,但我无法编辑它。有什么建议?

I have two Date/Time fields[ClockIN] and [ClockOut] in a table called tblTIMES that each store a date and time formatted as (mm/dd/yy hh:nn:ss AMPM).

I use "Format("ClockIn","mm/dd/yyyy")" and "Format("ClockIn","hh:nn:ss AMPM")" to separate the respective Date or Time where I need to do so.

One of those places is a text box on a form that I want to use to edit the Date and/or time of a specific record.

This does not seem to work.

I can successfully display the formatted date or time, but I cannot edit it. Any suggestions?

推荐答案

Wesley:

这似乎不起作用。
Wesley:
This does not seem to work.



它不会,因为如果你这样做,控件就不会绑定到你的领域。它有一个你无法改变的值集(因为这正是你通过将 ControlSource 属性设置为表达式而不是 RecordSource中的字段而告诉它的行为形式)。


建议:

不要分开日期和时间。使用TextBox的 Format 属性可以根据需要放置数据,并将TextBox绑定到字段本身(直接)。这样一切都能自然地起作用; - )

It wouldn''t, as the control is not bound to your field if you do it that way. It has a value set which you cannot change (as that''s exactly what you''ve told it to do by setting the ControlSource property to an expression rather than a field from the RecordSource of the form).

Suggestion:
Don''t separate the date and the time. Use the Format property of the TextBox to lay the data out as you would like and bind the TextBox to the field itself (directly). That way everything just works naturally ;-)


我明白了,这完全有道理!我不认为TextBox能够格式化内置数据。谢谢!!
I understand, and that totally makes sense! I wasn''t thinking that the TextBox has the ability to Format data built in. Thanks!!


Wesley很高兴。这就是分享经验的全部意义: - )
It''s a pleasure Wesley. That''s what sharing experience is all about :-)


这篇关于如何编辑格式化的日期/时间字段的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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