按日期防止重复订单 [英] Prevent Duplicate Order by date

查看:89
本文介绍了按日期防止重复订单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




i需要一些帮助,我不是vba用户,但我确实使用基本的宏。

我想达到这样的效果;


字段一:ID(主键)

字段二;姓名

第三场:日期

,我得到了一些小表格。作为某种订单。


我希望它在一个日期通知我重复名称。当我在其中输入地址时。

让我再试一次。


一个客户一天内不能有多个订单。即使他重复购买,也应该通知今天我们已经得到了他的另一份订单。所以我可以简单地保留名称,但是在之前的订单下放一个子记录。


但是忽略任何不符合当前日期的订单。


希望解释一下。


a先谢谢。

Hi,

i need some help here and i m not a vba user but i do use basic macros.
I was to achieve something like this;

field one: ID (Primary key)
Field two; Name
Field three: date
and i got a little subform with these. as some kind of order sheet.

i want it to notify me for Duplicate Name but on a single date. when i enter address in it.
Let me try and explain it again.

One customer cant have more than one orders in a day. even if he makes a repeat purchase, it should notify that today we already got his another order. So i can simply leave the name as it is, but put a child record under the previous order.

but ignore any order which are not with the current date.

Hope that explains.

an Advance thanks.

推荐答案

没有必要任何代码。在您的姓名和日期字段上添加唯一索引。这将阻止任何具有重复名称/日期组合的条目。
There''s no need for any code. Put a unique index on your name and date fields. That will prevent any entry with a duplicate name / date combination.


您描述的内容让我困惑。如果他不能在同一天发出另一个订单,那么如何将儿童记录置于先前的订单之下?


尽管如此,我建议你的第一步是看看你桌子的设计。应该包含包含这两个字段的唯一索引。在那之后,两次输入相同的数据是不可能的。查看数据库规范化和表格结构


如果你有一个基本合理的设计,那么你可以考虑是否还需要其他任何东西,如果有的话,那是什么。
What you describe confuses me. If he cannot make another order the same day, how can a child record be put under the previous order?

Be that as it may, I suggest your first step is to look at the design of your table. A unique index that includes both those fields should be put in place. After that, it won''t be possible to enter the same data twice. Check out Datebase Normalisation And Table Structures.

When you have a fundamentally sensible design, then you can consider if anything else is even required and, if so , what that is.


@rabbit应该我只是将这两个字段更改为Indexed(No Duplicates)?
@rabbit Should i just change these two fields to Indexed (No Duplicates)?


这篇关于按日期防止重复订单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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