使用DCount时出现逻辑错误 [英] Logic Error when using DCount

查看:61
本文介绍了使用DCount时出现逻辑错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在编辑预订记录时,我希望通过查看预订表来确认更改,以确定没有发生混淆。


我有如下记录: -


地点开始日期开始时间结束时间


房间1 3/11/2011 08:00 AM 13:00 PM等


当我编辑房间或日期它似乎工作正常但如果我改变时间(开始或结束或两者),代码说它会与另一个预订混淆。

我的代码如下: -

When editing a booking record I wish to validate the change by looking in the bookings table to check that confilct does not occur.

I have a record as follows:-

Location Start Date Start time End Time

Room 1 3/11/2011 08:00 AM 13:00 PM etc.

When I Edit Either Room or Date it appears to work OK but If I change the Time (either Start or end or Both) the code says it confilcts with another booking.

My Code is as follows:-

展开 | 选择 | Wrap | 行号

推荐答案

要使预订无效:
  1. 开始日期和位置必须相同,并且必须存在以下3个条件中的至少一个:
  1. The Start Date and Location would have to be the same, and at least 1 of the following 3 conditions must exist:
  1. 开始时间介于开始之间和结束范围。
  2. OR
  3. 结束时间介于开始和结束范围之间。
  4. OR
  5. 开始时间是< ; <开始时间和结束时间>结束时间

  • 我认为SQL就是:

  • The SQL as I see it, would be:

    展开 | 选择 | 换行 | 行号


    您好ADezii,

    非常感谢,我已经尝试了,结果显示有效,即使新时代与另一个预订冲突。


    我可能会尝试在这里做不可能的事情。


    我有一个表格列出了所选日期的一些预订。我试图从表单中选择任何记录并更改字段。我需要做的是检查输入到表单上的新iformation是否与表中保存的任何记录冲突。我正在使用Me.variable来表示Form和表格,我想知道我的逻辑是否错误。


    使用MsgBox捕获变量似乎表明Me.variable是相等的到[表变量]。然而,SQL的结果应该是无效的,不是吗?当您更改绑定表单中的日期时,这是否也会更改记录值?
    Hi ADezii,
    Many thanks for this, I have tried it and the results show VALID, even though the new times conflict with another booking.

    I may be trying to do the impossible here however.

    I have a form which lists a number of bookings for a chosen date. I am trying to select any of the records from the form and change a field. What I need to do then is check that the new iformation entered onto the form does not conflict with any record held within the table. I am using Me.variable to for both the Form and the table and am wondering if my logic is wrong.

    Capturing the variables using MsgBox appears to show that the Me.variable is equal to the [Table Variable]. The result of the SQL however should be Invalid shoudn''t it?. When you change date in a bound Form, does this change the record value also?


    尝试在实际验证之前保存记录Cyd44。如果这不起作用,请发送(附加)引用的表单以及基础数据源,希望我能看到问题所在。
    Try Saving the Record prior to the actual Validation, Cyd44. If this doesn''t work, sends me (Attach) the referenced Form along with the underlying Data Source, and hopefully I can see where the problem lies.


    这篇关于使用DCount时出现逻辑错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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