如果语句没有给出资源数据库的预期结果 [英] If statements not giving desired results for resources database

查看:36
本文介绍了如果语句没有给出资源数据库的预期结果的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个保留和发布资源的数据库(Access 2010,Windows 7)。编码贷款项目预订的宏的问题就出现了。我可以让宏显示同一资源的多个预留(前提是它们都在同一天)。但是,我为此付出的代价是,如果我今天预订,在稍后设置退货时,宏将不允许我在超时之前设置时间。虽然这对于同一天的预订是有意义的,但它不一定适用于另一天应该返回的预订。


这个限制是通过一些if语句设置来测试的''DueDate''不在''Reservation from date'之前,并且资源签入的时间不在签出时间之前:

Hi,
I''ve got a database (Access 2010, Windows 7) that reserves and issues resources. The problem arises for the macro that codes the reservations for the loan items. I can get the macro to display multiple reservations of the same resource (provided they are all on the same day). However, the price I pay for this is that if I make a reservation for today, while setting the return on a later date, the macro will not permit me to set the time in before the time out. While this makes sense for reservations on the same day, it doesn''t necessarily for reservations that should be returned on another day.

This limitation is set through some if statements to test that the ''DueDate'' is not before the ''Reservation From date'', and that the Time the resources are checked in is not before the time they are checked out:

展开 | 选择 | < span class =codeLinkonclick =WordWrap(this);> Wrap | 行号

推荐答案

您可能需要考虑使用日期/时间值而不是sep arate日期和时间。它可以用后一种方式来做,但更多(并且不必要地)如此复杂(正如你已经发现的那样)。
You may want to consider working with Date/Time values rather than separate dates and times. It''s possible to do it the latter way, but more (and unnecessarily so) complicated (As you''ve already found of course).


感谢您花时间去看看并回复NeoPa。我假设你的意思是从短时间改为通用日期。我试过这个并没有什么区别。如果我可以将问题归结为一个短段,那就是这个。数据库宏将允许我在一天内多次保留相同的设备。它还允许我在超过一天的时间内保留一件物品。它不会让我同时保留2。除了保留项目之外,还有一些宏,尤其是书籍项目和更新预约,以便在收集和返回时单击并返回项目。 TimeOut,DateCheckedOut,DueDate和TimeIn采用短时格式。我将它们全部更改为General Date,但结果是一样的。我应该使用不同的日期格式,还是因为你的意思是我应该以不同的方式编写宏中的代码?
Thanks for taking the time to look and reply NeoPa. I am assuming you mean changing from Short Time to General Date. I have tried this and it makes no difference. If I can boil the problem into one short paragraph, it would be this. The database macro will let me reserve the same equipment multiple times within one day. It will also permit me to reserve one item over the duration of more than one day. It won''t let me reserve the 2 concurrently. There a several macros, besides the reserve item, not least a book item and an an update reservation to click out and return the item on collection and return. TimeOut, DateCheckedOut, DueDate and TimeIn were in Short Time Format. I changed them all to General Date, but the result is the same. Is there a different date format I should use or due you mean I should write the code in the macro differently?


格式完全不相关:-(


如果您存储您正在使用的时间点的日期和时间,那么您会发现使用它们更容易。而不是说:
The format is entirely irrelevant :-(

If you store the date and the time of the points in time you''re working with then you will find it easier to work with them. Instead of saying :
展开 | 选择 | Wrap | 行号


这篇关于如果语句没有给出资源数据库的预期结果的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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