工作时间表的冲突时间 [英] Conflicting time for work schedule

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

问题描述

您好,

我有ms访问数据库,我用它来为员工分配加班费。


一个一个''加班线''字段:行号,日期,开始时间,结束时间。


Tbl Two''员工列表''字段:员工姓名,Emp ID,资历号

Tbl three''加班注册员工姓名,加班行号,资格?,位置

员工通过在线选择加班号码提前一周注册。员工可以注册所有线路。此线路时间可以重叠,例如

开始时间结束时间

0500 0900

0600 1000

0700 1000等等。
这可以超过2000条记录。

我们每周都会注册并上传它以访问Signup tbl。


我已经创建了一个批准这个加班的表格。我们只是添加位置(日期,开始时间和结束时间已预先填充)以标记加班被批准。使用此表格。 (表单中的所有字段都来自相同的tbl)


当OT的批准者通过仅添加批准的位置批准插槽时(表格中预先填写了开始时间和结束时间),下次批准者通过添加位置批准同一员工的另一个插槽时,该位置与先前批准的行(添加的位置)重叠。

问题我面临的问题是我没有输入开始和结束时间,所以不能放置代码来发起冲突消息。

很快他/她就进入了这个位置。

我希望代码或查询检查当前预先填充的开始时间和结束时间,以及与Location相关的任何冲突的上一个开始和时间。如果没有冲突(没有记录添加位置)它应该除了位置,如果有冲突我想要删除该位置并弹出有冲突的消息并转到下一条记录。

我必须创建新表吗?因为毕竟加班时间被批准了。查询在PDF格式报告中生成已批准的OT,其中包括员工姓名,他被批准的OT日期以及他被批准的OT时间。

所以我正在寻找的是我能做些什么来预防如果上一次与新批准冲突,则用户添加位置。 SO程序应该检查五件事,员工,日期,开始时间,结束时间和位置是否为空。


我在Query中添加了代码以检查开始时间,结束时间,员工名称和加班行号通过添加同一个表的两个副本。但它不起作用,因为我已经预先填充了表格中的数据。因此,当我在表单控件中使用此代码在添加位置后添加记录时,它只会显示消息,因为它只检查日期时间和员工姓名。

我已经尝试了很长时间而且不能放手。请帮助我理解并指出正确的方向。

我会很高兴。

谢谢,

解决方案

< blockquote>您需要向我们展示您正在使用的代码。告诉我们你不工作的意思。


我不是程序员。


喜欢访问并创建简单的数据库。


我在查询中有这个代码,我在网上找到了。

我在我的查询中添加了这段代码。

我从此查询创建了一个报告,并在表单命令按钮中添加了报告,以警告存在冲突。


我很快就会添加位置,因为所有员工已注册重叠加班,所以每条消息都会出现。


所以我认为这只有在您尝试添加新记录时才有效。但我的桌子已经有了所有记录。


我唯一要做的就是在表单中添加基于同一个表的位置,该表包含所有记录,包括开始和结束时间。

我将非常感谢你的帮助

展开 | 选择 | Wrap | 行号


< a href =http://bytes.com/topic/access/answers/950310-conflicting-time-work-schedule#post3752753\"target =_ blank>发布#1> ... 我创建了a 表格 批准加班。

发布#3> ... 我从此查询创建了报告,并在表单命令按钮中添加了 报告 警惕有冲突。



我怀疑你的意思是表格,而不是在你的第二篇文章中报道,是吗?这两个术语是不可互换的。


我们需要控件背后的完整代码,而不仅仅是小片段:

打开表单在设计模式中。

右键单击命令按钮。

在弹出菜单的底部,选择属性。

选择事件选项卡。

现在,您将看到左侧有名称的事件触发器列表,如果附加了代码,则会显示...

在开启按一下[;你会看到[事件程序]或[嵌入式宏],如果你没有看到这个请回发。

在任何一种情况下,点击显示其中的按钮:

  • 对于[事件过程],VBA编辑器将打开与控件相关的代码。请选择整个文本,包括Sub(名称或您的控件)_click()直通和包含End Sub
  • 在[Embedded Macro]的情况下,将打开宏编辑器。如果您使用的是Access V2007或V2010,则可以< ctrlA>,< ctrlC>否则你必须手动输入宏。

现在,在这里底部的回复框中,首先点击 [CODE /] 按钮,这将插入 [code] .. [/ code] "在这两个标签之间,您将要么< ctrlV>将复制的文本粘贴到帖子中,或者您必须手动输入宏代码。

现在您可以提交帖子。

请不要忘记在两个 [code] .. [/ code] 之间输入您的代码。标签


Hello,
I have the ms access database which I use to assign overtime to employee.

One tbl One ''Overtime Lines'' Fields: Line No, Date, Start Time, End Time.

Tbl Two ''Employee List'' Fields: Employee name, Emp ID, Seniority No.

Tbl three ''Overtime Signups Employee Name, Overtime Line number, Qualifications?, Location
Employee signup a week in advance by selecting overtime line number on line. Employees are allowed to signup all the lines. This line timings can be overlapping such as
Start Time End Time
0500 0900
0600 1000
0700 1000 etc.
This can go to over 2000 records.
We pull signup every Week and upload it to access Signup tbl.

I have created a form to approve this overtime. We are only adding location (date, start time and end time is already pre populated) to mark as overtime is approved. using this form. (All the fields in the form are from same tbl)

When approver of OT approves a slot by adding only location as approved (Start and End Time are pre populated in the form) , next time when approver approves another slot for the same employee by adding location, which is overlapping with previously approved line (Added Location).
Problem I am facing is I am not entering Start and End time so can?t put the code to initiate the conflict message.
Soon he / She enters the location.
I want code or query to check current pre-populated Start time and End time with previous start and time for any conflict which is related to Location. If there is no conflict (No Record with location added) it should except the location, if there is a conflict I want to delete the location and pop the message that there is a conflict and goes to next record.
Do I have to create new table? Because after all the overtime slots are approved. Query is generating approved OT in a PDF format report with Employee name, Date of OT he is approved and Time of OT he is approved for.
So What I am looking for is What I can do from preventing user to add location if the previous time is conflicting with new approval. SO program should check five things, Employee, Date, Start Time, End Time, and Location is blank or not.

I have added code in Query to check Start Time, EndTime, Employee Name, and Overtime line number by adding two copies of the same table. But it is not working because I already have the data in the table that is prepopulated in advance. so when I use this code in a form control to add record after just adding location it just comes up with the message because it is only checking for date time and employee name.
I have been trying for long time and can''t just let it go. Please help me understand and point me to right direcion.
I will be greatful.
Thank you,

解决方案

You need to show us the code you''re using. And tell us what you mean by not working.


I am not a programmer.

Like access and create simple databases.

I have this code in my query which I found on line.
I have added this code in my query.
I created a report from this query and added the report in form command button to give alert that there is a conflict.

Soon I add location each and every approval that message comes up because all employees have signed up for overlapping overtime.

So I think this can only work when you try to add new record. But My table already has all the record.

The only thing I am doing is adding the location in the form that is based on this same table which has all the records including start and end time.

I would appreciate your help

Expand|Select|Wrap|Line Numbers


Post#1>...I have created a form to approve this overtime.

Post#3>...I created a report from this query and added the report in form command button to give alert that there is a conflict.

I suspect that you mean form and not report in your second post, yes? The two terms are NOT interchangable.

We''ll need the full code behind the control, not just the little snip-it:
Open your form in design mode.
Right click on the command button.
In the pop-up menu, at the bottom, select properties.
Select the "Events" tab.
You will now see a listing of event triggers with names on the left side and and, if there is a code attached...
In the "on click" you will see either [Event Procedure] or [Embedded Macro], if you do not see this please post back.
In either case, click on the button that shows [...] in it:

  • In the case of the [Event Procedure], the VBA editor will open to the code related to the control. Please select the entire text, including the "Sub (name or your control)_click() thru and inculding "End Sub"
  • In the case of [Embedded Macro], the Macro editor will open. If you are using either Access V2007 or V2010, then you can <ctrlA>, <ctrlC> otherwise you will have to hand type the macro into a post.

Now, in the reply box at the bottom here, FIRST click the [CODE/] button, this will insert "[code]..[/code]" between these two tags, you will either <ctrlV> to paste the copied text into the post, or where you will have to hand enter the macro code.
Now you may submit the post.
PLEASE, do NOT forget to enter your code between the two "[code]..[/code]" tags.


这篇关于工作时间表的冲突时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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