如何防止重叠时间表? [英] How to prevent overlapping schedules?

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

问题描述

我使用的是Microsoft Office XP,我开发了一个Access数据库,用于安排建筑物内的会议室和培训室。


我有一个名为Events的主要表单。用于安排这些房间。

事件表单上有几个字段,例如Building和Building。这是一个名为cmbBuilding的组合框。下面有一个字段建筑物命名为位置的这被称为cmbLocation。建筑物和位置的2个字段是相关的,因为当有人从列表中选择建筑物时,它会修改位置下拉框中可用的选项,因为不同的建筑物在不同楼层上具有不同的房间。我有一个Locations表和一个Buildings表,表单用来填充下拉框。

位置字段下面是cmbStartDate,cmbEndDate, ; txtStartTime"," txtEndTime"以及与我的问题无关的其他字段。


事件表单更新事件具有以下字段名称的表:

Location,Building",StartDate,EndDate,StartTime,EndTime。


我想防止地点被双重预订。


例如:

人员1时间表想在亚特兰大预订房间(cmbBuilding在表格上,建筑在桌子上)。他们从表格上的建筑物下拉框中选择亚特兰大,并将其下方的位置下拉框修改为仅显示亚特兰大的房间。然后,他们从日历控件中选择一个日期,该日历控件填充表单上的StartDate和EndDate字段(表单上的cmbStartDate和cmbEndDate,但表上的StartDate和EndDate)。日期是自动格式化为这种格式:MM / DD / YYYY ...或M / D / YYYY如果月份和日期恰好小于10(换句话说,如果少于10,它就不会进入前导0超过10,例如不是2008年1月3日,仅仅是1/3/2008)。然后他们输入一个StartTime和EndTime(表格上的txtStartTime和txtEndTime,表格上的StartTime和EndTime)。


所以...亚特兰大 - 5楼 - 2008年3月23日通过2008年3月25日从09:00开始,直到每天下午01:00。


如果预订完成,我不希望任何人能够安排一个亚特兰大在5楼的日期,即2008年3月23日至2008年3月25日,上午9点至下午1点之间。然而,他们仍然可以在2008年3月23日至2008年3月25日期间的上午8点到9点安排会议,他们还应该能够在2008年3月23日下午1点到3/25之间安排一些事情。 / 2008.


我在以下几页回顾了这些论坛的讨论:
http://www.thescripts.com/forum/thread604404.html
http://www.thescripts.com/forum/thread607917.html


并认为可以修改代码建议在他的情况下帮助他:

展开 | 选择 Wrap | 行号

解决方案

有人有任何建议吗?


我会感谢任何可能提供的指导。即使它只是说你不认为代码适用于我的情况,所以我可能会尝试寻找另一个方向。


谢谢你,

您好。您的代码逻辑似乎没问题,因为它确实检查了与另一个预订重叠的开始和结束时间。你的IF..ELSEIF部分有一些冗余,可以简化为

展开 | 选择 | Wrap | 行号


I am using Microsoft Office XP and I have developed an Access database that is used to schedule conference and training rooms within buildings.

I have one main form named "Events" that is used to schedule these rooms.
The "Events" form has several fields on it such as "Building" which is a Combo box with the name "cmbBuilding". There''s a field below "Building" named "Location" which is called "cmbLocation". The 2 fields Building and Location are related because when someone chooses a buildling from the list, it modified what options are available in the Location drop down box since different buildings have different rooms on different floors. I have a Locations table, and a Buildings table, which the form uses to populate the drop down boxes.

Below the Location field is "cmbStartDate", "cmbEndDate", "txtStartTime", "txtEndTime" and other fields that are not related to my question.

The "Events" form updates an "Events" table which has these Field Names:
"Location", "Building", "StartDate", "EndDate", "StartTime", "EndTime".

I want to prevent locations from being double booked.

Example:
Person 1 schedules wants to reserve a room in Atlanta (cmbBuilding on form, Building on table). They choose Atlanta from the Building drop down box on the form and the Location drop down box below it gets modified to only show rooms in Atlanta. They then pick a date from a calendar control that populates the StartDate and EndDate fields on the form (cmbStartDate and cmbEndDate on the form but StartDate and EndDate on the table). The dates are autoformatted to this format : MM/DD/YYYY ... or M/D/YYYY if the month and day happen to be less than 10 (in other words, it doesn''t put in the leading 0 if less than 10 e.g. not 01/03/2008, simply 1/3/2008). They then enter a StartTime and EndTime (txtStartTime and txtEndTime on the form, StartTime and EndTime on the table).

So... Atlanta - 5th Floor - 3/23/2008 through 3/25/2008 from 09:00am untill 01:00pm on each of those days.

If this reservation was made, I don''t want anyone to be able to schedule a date for Atlanta on the 5th floor, between 3/23/2008 and 3/25/2008 between the hours of 9 am to 1pm. However they should still be able to schedule a meeting from 8am to 9am on between 3/23/2008 and 3/25/2008, and they should also still be able to schedule something after 1pm on 3/23/2008 through 3/25/2008.

I reviewed the discussion on these forums at the following pages:
http://www.thescripts.com/forum/thread604404.html
http://www.thescripts.com/forum/thread607917.html

And thought it might be possible to modify the code they suggested that would help him in his situation:

Expand|Select|Wrap|Line Numbers

解决方案

Does anyone have any suggestions, please?


I would appreciate any guidance that could be provided. Even if it''s simply saying that you don''t think the code would work for my situation, so that I might try looking in another direction.

Thank You,


Hi. Your code logic seems OK in that it does check for start and end times that overlap another booking. You have some redundancy in your IF..ELSEIF part which can be simplified to

Expand|Select|Wrap|Line Numbers


这篇关于如何防止重叠时间表?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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