改变时间面具问题 [英] Changing Time Mask Problems

查看:75
本文介绍了改变时间面具问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




所以我正在使用Access 2002数据库进行废物管理。在我离开之前将我的程序放在一起之前我的角色中的人,现在我负责它。根据使用数据库的员工的要求更新了几个区域后,我遇到了如何存储日期的问题。


我有一个表格供员工用来输入数据,这包括一个日期框。当最初选项卡或点击它时会显示今天的日期。它被设置为短日期形式,面具99/99/0000; 0; _。


当我意识到如果你刚刚覆盖它时,我第一次遇到问题就像员工接受过培训一样,它也会包括时间。在日期中输入的任何条目都不会被稍后在程序中的查询接收。


我检查了代码并找到了这个:
< br $>
私有子Date_Enter()


日期= DateAdd(" h",-7,Now())


End Sub


由于这是从7小时前增加小时,我认为这是问题所在。但是当我删除这一行时,日期框将不再自动显示今天的日期。然后我在小时后添加了以下代码:


日期=格式([日期],mm / dd / yyyy)


这似乎解决了这个问题。但现在当您通过数据输入系统访问旧记录并单击日期时,它会将日期弹出到完整掩码中并允许您编辑它,即使控件设置为在保存记录之后无法编辑或删除。在添加这行代码之前,它不会这样做,因此一旦保存就无法编辑记录。


我的问题是,有没有办法阻止这种编辑旧的能力/保存记录,同时保持正确的日期格式,没有时间问题?


感谢您的帮助,


James

Hi,

So I''m working with an Access 2002 database for waste managemnt. The person in my role before my put together the program before he left and now I''m in charge of it. After updating a few areas based on the requests of the employees using the database I have come accross a problem with how dates are stored.

I have a form for the employees to use to input data, and this includes a box which is for the date. When initially tabbed over to or clicked on it brings up todays date. It is set to be in the form Short Date with the mask 99/99/0000;0;_.

I first ran into problems when I realized that if you just abbed over it, like the employees were trained to do, it would also include the time. Any entry entered with a time on the date would not get picked up by a query later on in the program.

I checked the code for this and found this:

Private Sub Date_Enter()

Date = DateAdd("h", -7, Now())

End Sub

Since this is adding the hour from 7 hours ago I assumed this was the problem. But when I removed this line, the date box would no longer automatically bring up today''s date. I then added the following code after the hour line:

Date = Format([Date], "mm/dd/yyyy")

And this seemed to solve the problem. But now when you access an old record through the data entry system and click on the date, it will pop the date out into the full mask and allow you to edit it, even though the controls are set that after a record has been saved it cannot be edited or deleted. Before adding this line of code it would not do this, and therefore the record could not be edited once saved.

My question is, is there a way to stop this ability to edit old/saved records while still keeping the proper date format without the time problem?

Thanks for any help,

James

推荐答案

我手边的唯一方法是编程。

Off hand the only way I would do it is programmatically.

展开 | 选择 | 换行 | 行号


我需要锁定每条记录。在我用时间掩码改变问题之前就是这样的,但是因为它允许它被更改。


我尝试使用你的代码并没有帮助。但是当我把日期弹出到完整的面具时,我意识到它正在做什么,它突然出现在今天的日期。我检查了旧条目,当我点击它的日期时,它会如下:

1/31/2007 - >点击它 - > 2_ / 6_ / 2007 - >标签 - > 2007年2月6日


如果我点击Escape而不是tab,它会回到2007年1月31日


更多信息形式是每个废物负载,1个表格将填写员工编号,班次,日期,产品和重量。因此,平均班次将使员工填写5到20个表格,每个表格创建一个新记录。随着时间的推移和班次的变化,新员工将占据记录废物的位置,在同一天创建更多记录,只需要不同的班次和员工编号。


再次感谢您的帮助
I need every record to be locked. It was like this before I changed the problems with the time mask, but ever since it allows it to be changed.

I tried working with your code and it didn''t help. But I realized what it is doing when it is popping the date out to the full mask, its popping it out to today''s date. I checked on old entries, when I clicked on the date it would go as follows:
1/31/2007 -> Click On It -> 2_/6_/2007 -> Tab -> 2/6/2007

If I hit Escape instead of tab it goes back to 1/31/2007

Some more info on the form is that for each load of waste, 1 form will be filled out with employee number, shift, date, product, and weight. So the average shift will have the employee filling out anywhere from 5 to 20 forms, each creating a new record. Then as the day goes on and the shift changes, a new employee will take the position of recording wastes, creating more records on the same date, just with a different shift and employee number.

Thanks again for any help


您是否需要它们能够同时查看旧记录以及添加新记录?
Do you need them to be able to view older records as well as add new records at the same time?


这篇关于改变时间面具问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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